This commit is contained in:
Cameron Kaiser 2017-05-29 17:53:39 -07:00
parent b384d72987
commit 2adbafdb5b

View File

@ -2095,19 +2095,24 @@ nsDocumentViewer::Hide(void)
mPresShell->CaptureHistoryState(getter_AddRefs(layoutState)); mPresShell->CaptureHistoryState(getter_AddRefs(layoutState));
} }
DestroyPresShell(); {
// Do not run ScriptRunners queued by DestroyPresShell() in the intermediate
// state before we're done destroying PresShell, PresContext, ViewManager, etc.
nsAutoScriptBlocker scriptBlocker;
DestroyPresShell();
DestroyPresContext(); DestroyPresContext();
mViewManager = nullptr; mViewManager = nullptr;
mWindow = nullptr; mWindow = nullptr;
mDeviceContext = nullptr; mDeviceContext = nullptr;
mParentWidget = nullptr; mParentWidget = nullptr;
nsCOMPtr<nsIBaseWindow> base_win(mContainer); nsCOMPtr<nsIBaseWindow> base_win(mContainer);
if (base_win && !mAttachedToParent) { if (base_win && !mAttachedToParent) {
base_win->SetParentWidget(nullptr); base_win->SetParentWidget(nullptr);
}
} }
return NS_OK; return NS_OK;