зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1105468 - OpenFileAndSendFDRunnable::OpenFile needs to ensure we don't release off main thread. r=bent
This commit is contained in:
Родитель
762d9b52df
Коммит
53d885d990
|
@ -171,7 +171,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void OpenFile()
|
||||
// Helper method to avoid gnarly control flow for failures.
|
||||
void OpenFileImpl()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!mFD);
|
||||
|
@ -185,10 +186,21 @@ private:
|
|||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
mFD = fd;
|
||||
}
|
||||
|
||||
void OpenFile()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
OpenFileImpl();
|
||||
|
||||
if (NS_FAILED(NS_DispatchToMainThread(this))) {
|
||||
NS_WARNING("Failed to dispatch to main thread!");
|
||||
|
||||
// Intentionally leak the runnable (but not the fd) rather
|
||||
// than crash when trying to release a main thread object
|
||||
// off the main thread.
|
||||
mTabParent.forget();
|
||||
CloseFile();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче