Bug 1463819: Account for the possibility of SyncAttributesToWidget destroying the window. r=enn

MozReview-Commit-ID: 8O3We8wnSGk
This commit is contained in:
Emilio Cobos Álvarez 2018-05-25 20:58:56 +02:00
Родитель f983b7cb92
Коммит 9af9874166
2 изменённых файлов: 11 добавлений и 14 удалений

Просмотреть файл

@ -448,9 +448,6 @@ NS_IMETHODIMP nsXULWindow::Create()
NS_IMETHODIMP nsXULWindow::Destroy()
{
MOZ_DIAGNOSTIC_ASSERT(!mSyncingAttributesToWidget,
"Destroying the window from SyncAttributesToWidget?");
if (!mWindow)
return NS_OK;
@ -1124,13 +1121,15 @@ void nsXULWindow::OnChromeLoaded()
mChromeLoaded = true;
ApplyChromeFlags();
SyncAttributesToWidget();
SizeShell();
if (mShowAfterLoad) {
SetVisibility(true);
// At this point the window may have been closed during Show(), so
// nsXULWindow::Destroy may already have been called. Take care!
if (mWindow) {
SizeShell();
if (mShowAfterLoad) {
SetVisibility(true);
}
}
// At this point the window may have been closed already during Show() or
// SyncAttributesToWidget(), so nsXULWindow::Destroy may already have been
// called. Take care!
}
mPersistentAttributesMask |= PAD_POSITION | PAD_SIZE | PAD_MISC;
}
@ -1550,9 +1549,6 @@ void nsXULWindow::SyncAttributesToWidget()
if (!windowElement)
return;
AutoRestore<bool> scope { mSyncingAttributesToWidget };
mSyncingAttributesToWidget = true;
MOZ_DIAGNOSTIC_ASSERT(mWindow, "No widget on SyncAttributesToWidget?");
nsAutoString attr;
@ -2426,7 +2422,9 @@ nsXULWindow::BeforeStartLayout()
ApplyChromeFlags();
LoadPersistentWindowState();
SyncAttributesToWidget();
SizeShell();
if (mWindow) {
SizeShell();
}
return NS_OK;
}

Просмотреть файл

@ -179,7 +179,6 @@ protected:
// mDestroying is used to prevent reentry into into Destroy(), which can
// otherwise happen due to script running as we tear down various things.
bool mDestroying;
bool mSyncingAttributesToWidget = false;
bool mRegistered;
uint32_t mPersistentAttributesDirty; // persistentAttributes
uint32_t mPersistentAttributesMask;