зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155059: Patch 6 - fix problems with gfxFontInfoLoader shutdown sequence r=jdaggett
This commit is contained in:
Родитель
b63478816a
Коммит
5211d5e9ad
|
@ -66,7 +66,6 @@ FontInfoLoadCompleteEvent::Run()
|
|||
|
||||
loader->FinalizeLoader(mFontInfo);
|
||||
|
||||
mFontInfo = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -81,7 +80,6 @@ AsyncFontInfoLoader::Run()
|
|||
|
||||
// post a completion event that transfer the data to the fontlist
|
||||
NS_DispatchToMainThread(mCompleteEvent);
|
||||
mFontInfo = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -140,23 +138,27 @@ gfxFontInfoLoader::StartLoader(uint32_t aDelay, uint32_t aInterval)
|
|||
InitLoader();
|
||||
|
||||
// start async load
|
||||
mState = stateAsyncLoad;
|
||||
nsresult rv = NS_NewNamedThread("Font Loader",
|
||||
getter_AddRefs(mFontLoaderThread),
|
||||
nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
mState = stateAsyncLoad;
|
||||
|
||||
nsCOMPtr<nsIRunnable> loadEvent = new AsyncFontInfoLoader(mFontInfo);
|
||||
|
||||
mFontLoaderThread->Dispatch(loadEvent, NS_DISPATCH_NORMAL);
|
||||
mFontLoaderThread->Dispatch(loadEvent.forget(), NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontInfoLoader::FinalizeLoader(FontInfoData *aFontInfo)
|
||||
{
|
||||
// avoid loading data if loader has already been canceled
|
||||
// Avoid loading data if loader has already been canceled.
|
||||
// This should mean that CancelLoader() ran and the Load
|
||||
// thread has already Shutdown(), and likely before processing
|
||||
// the Shutdown event it handled the load event and sent back
|
||||
// our Completion event, thus we end up here.
|
||||
if (mState != stateAsyncLoad) {
|
||||
return;
|
||||
}
|
||||
|
@ -187,8 +189,11 @@ gfxFontInfoLoader::CancelLoader()
|
|||
mTimer = nullptr;
|
||||
}
|
||||
if (mFontLoaderThread) {
|
||||
mFontLoaderThread->Shutdown();
|
||||
mFontLoaderThread = nullptr;
|
||||
// NOTE: Shutdown() runs the event loop, and we can get timer events
|
||||
// ensure that we can't try to do this twice!
|
||||
nsCOMPtr<nsIThread> temp;
|
||||
temp.swap(mFontLoaderThread);
|
||||
temp->Shutdown();
|
||||
}
|
||||
RemoveShutdownObserver();
|
||||
CleanupLoader();
|
||||
|
|
Загрузка…
Ссылка в новой задаче