From 36bfd0bc9cfa070992b5b64d49d72da41f079d5c Mon Sep 17 00:00:00 2001 From: Fedor Date: Sat, 9 May 2020 00:36:53 +0300 Subject: [PATCH] [XPFE] Properly anchor XUL windows when tearing down. --- xpfe/appshell/nsXULWindow.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 8f2d9fde5..585085065 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -455,6 +455,8 @@ NS_IMETHODIMP nsXULWindow::Destroy() if (mDestroying) return NS_OK; + nsCOMPtr kungFuDeathGrip(this); + mozilla::AutoRestore guard(mDestroying); mDestroying = true; @@ -467,16 +469,6 @@ NS_IMETHODIMP nsXULWindow::Destroy() if (parentWindow) parentWindow->RemoveChildWindow(this); - // let's make sure the window doesn't get deleted out from under us - // while we are trying to close....this can happen if the docshell - // we close ends up being the last owning reference to this xulwindow - - // XXXTAB This shouldn't be an issue anymore because the ownership model - // only goes in one direction. When webshell container is fully removed - // try removing this... - - nsCOMPtr placeHolder = this; - // Remove modality (if any) and hide while destroying. More than // a convenience, the hide prevents user interaction with the partially // destroyed window. This is especially necessary when the eldest window