Bug 1603927 - Do not try to pause compositor when nsWindow is destroyed r=stransky
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 16 Dec 2019 07:31:57 +0000
changeset 507048 c18a1b66855ca56a3933b5b63f5c5fa9d8eb8998
parent 507047 e1ef71575321e3a606eac6e8ff396110c5c13949
child 507049 b92d5b9b880a082ca7c9a61ad9addc88c35f5ab8
push id36922
push userncsoregi@mozilla.com
push dateMon, 16 Dec 2019 17:21:47 +0000
treeherdermozilla-central@27d0d6cc2131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1603927
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1603927 - Do not try to pause compositor when nsWindow is destroyed r=stransky Differential Revision: https://phabricator.services.mozilla.com/D57197
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -4431,33 +4431,35 @@ void nsWindow::HideWaylandWindow() {
   if (mWindowType == eWindowType_popup) {
     LOG(("nsWindow::HideWaylandWindow: popup [%p]\n", this));
     GList* foundWindow = g_list_find(gVisibleWaylandPopupWindows, this);
     if (foundWindow) {
       gVisibleWaylandPopupWindows =
           g_list_delete_link(gVisibleWaylandPopupWindows, foundWindow);
     }
   }
-  if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
-    // Because wl_egl_window is destroyed on moz_container_unmap(),
-    // the current compositor cannot use it anymore. To avoid crash,
-    // pause the compositor and destroy EGLSurface & resume the compositor
-    // and re-create EGLSurface on next expose event.
-    MOZ_ASSERT(GetRemoteRenderer());
-    if (CompositorBridgeChild* remoteRenderer = GetRemoteRenderer()) {
-      // XXX slow sync IPC
-      remoteRenderer->SendPause();
-      // Re-request initial draw callback
-      RefPtr<nsWindow> self(this);
-      moz_container_add_initial_draw_callback(mContainer, [self]() -> void {
-        self->mNeedsCompositorResume = true;
-        self->MaybeResumeCompositor();
-      });
-    } else {
-      DestroyLayerManager();
+  if (!mIsDestroyed) {
+    if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
+      // Because wl_egl_window is destroyed on moz_container_unmap(),
+      // the current compositor cannot use it anymore. To avoid crash,
+      // pause the compositor and destroy EGLSurface & resume the compositor
+      // and re-create EGLSurface on next expose event.
+      MOZ_ASSERT(GetRemoteRenderer());
+      if (CompositorBridgeChild* remoteRenderer = GetRemoteRenderer()) {
+        // XXX slow sync IPC
+        remoteRenderer->SendPause();
+        // Re-request initial draw callback
+        RefPtr<nsWindow> self(this);
+        moz_container_add_initial_draw_callback(mContainer, [self]() -> void {
+          self->mNeedsCompositorResume = true;
+          self->MaybeResumeCompositor();
+        });
+      } else {
+        DestroyLayerManager();
+      }
     }
   }
 #endif
   gtk_widget_hide(mShell);
 }
 
 void nsWindow::WaylandStartVsync() {
 #ifdef MOZ_WAYLAND