Bug 1882779 [Linux] Don't try to get NS_NATIVE_EGL_WINDOW for destroyed windows r=emilio

Depends on D205633

Differential Revision: https://phabricator.services.mozilla.com/D205634
This commit is contained in:
stransky 2024-03-26 12:24:09 +00:00
parent d69b233241
commit d402a041f5
2 changed files with 5 additions and 3 deletions

View file

@ -3421,9 +3421,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) {
// 2) If window is hidden on OnUnmap(), we replace EGLSurface/wl_surface
// by offline surface and release XWindow.
// If nsWindow is already destroyed, don't try to get EGL window at all,
// we're going to be deleted anyway.
MutexAutoLock lock(mWindowVisibilityMutex);
void* eglWindow = nullptr;
if (mIsMapped) {
if (mIsMapped && !mIsDestroyed) {
#ifdef MOZ_X11
if (GdkIsX11Display()) {
eglWindow = (void*)GDK_WINDOW_XID(mGdkWindow);
@ -5816,7 +5818,7 @@ void nsWindow::ConfigureCompositor() {
// too late
if (mIsDestroyed || !mIsMapped) {
LOG(" quit, mIsDestroyed = %d mIsMapped = %d", mIsDestroyed,
LOG(" quit, mIsDestroyed = %d mIsMapped = %d", !!mIsDestroyed,
!!mIsMapped);
return;
}

View file

@ -641,7 +641,7 @@ class nsWindow final : public nsBaseWidget {
// It's set by OnMap/OnUnmap which is based on Gtk events.
mozilla::Atomic<bool, mozilla::Relaxed> mIsMapped;
// Has this widget been destroyed yet?
bool mIsDestroyed : 1;
mozilla::Atomic<bool, mozilla::Relaxed> mIsDestroyed;
// mIsShown tracks requested visible status from browser perspective, i.e.
// if the window should be visible or now.
bool mIsShown : 1;