зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1366930 - Correct error handling in mozilla::MediaShutdownManager::InitStatics. r=gerald
Resetting sInstance in MediaShutdownManager::InitStatics() will cause MediaShutdownManager::Instance().Register() to crash immediately without a chance to handle the error in Register(). Instead, we keep an error code to know whether to bail out in Register(). MozReview-Commit-ID: EGqL1407Gh --HG-- extra : rebase_source : 055dfc35d854c93013067971f0c9f813c8654708
This commit is contained in:
Родитель
e008ecdf2f
Коммит
975c6c5f18
|
@ -78,7 +78,7 @@ MediaShutdownManager::InitStatics()
|
|||
NS_LITERAL_STRING("MediaShutdownManager shutdown"));
|
||||
if (NS_FAILED(rv)) {
|
||||
LOGW("Failed to add shutdown blocker! rv=%x", uint32_t(rv));
|
||||
sInstance = nullptr;
|
||||
sInstance->mError = rv;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ nsresult
|
|||
MediaShutdownManager::Register(MediaDecoder* aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!sInstance) {
|
||||
if (NS_FAILED(mError)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
if (mIsDoingXPCOMShutDown) {
|
||||
|
|
|
@ -83,6 +83,7 @@ private:
|
|||
nsTHashtable<nsRefPtrHashKey<MediaDecoder>> mDecoders;
|
||||
|
||||
bool mIsDoingXPCOMShutDown = false;
|
||||
nsresult mError = NS_OK;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче