Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro a=sylvestre FIREFOX_BETA_42_BASE
authorNicolas Silva <nsilva@mozilla.com>
Tue, 15 Sep 2015 17:58:06 +0200
changeset 289322 61bbc30704aa104e9929c719c0fd7957f96f00ea
parent 289321 980951a8a5e27bb74a906ce255c9a2530a965ac2
child 289323 b0e20ff87b175424edec414215b325918ccb4792
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro, sylvestre
bugs1156182
milestone42.0a2
Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro a=sylvestre
widget/gtk/nsWindow.cpp
widget/nsBaseWidget.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6410,16 +6410,21 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent
 }
 
 nsIWidget::LayerManager*
 nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
                           LayersBackend aBackendHint,
                           LayerManagerPersistence aPersistence,
                           bool* aAllowRetaining)
 {
+    if (mIsDestroyed) {
+      // Prevent external code from triggering the re-creation of the LayerManager/Compositor
+      // during shutdown. Just return what we currently have, which is most likely null.
+      return mLayerManager;
+    }
     if (!mLayerManager && eTransparencyTransparent == GetTransparencyMode()) {
         mLayerManager = CreateBasicLayerManager();
     }
 
     return nsBaseWidget::GetLayerManager(aShadowManager, aBackendHint,
                                          aPersistence, aAllowRetaining);
 }
 
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1153,16 +1153,20 @@ bool nsBaseWidget::ShouldUseOffMainThrea
 }
 
 LayerManager* nsBaseWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
                                             LayersBackend aBackendHint,
                                             LayerManagerPersistence aPersistence,
                                             bool* aAllowRetaining)
 {
   if (!mLayerManager) {
+    if (!mShutdownObserver) {
+      // We are shutting down, do not try to re-create a LayerManager
+      return nullptr;
+    }
     // Try to use an async compositor first, if possible
     if (ShouldUseOffMainThreadCompositing()) {
       // e10s uses the parameter to pass in the shadow manager from the TabChild
       // so we don't expect to see it there since this doesn't support e10s.
       NS_ASSERTION(aShadowManager == nullptr, "Async Compositor not supported with e10s");
       CreateCompositor();
     }