Bug 1596696 - Restore pre-bug 1576390 lock order. r=spohl
authorMarkus Stange <mstange@themasta.com>
Fri, 15 Nov 2019 20:35:10 +0000
changeset 502284 284910a66370a61a378e10f667256b5c5b59607f
parent 502283 bd42216f7b6309c683bcc8d9d63c26a834d08d04
child 502285 2cadb540632e5ff822f31b444a3870869676d772
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1596696, 1576390
milestone72.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 1596696 - Restore pre-bug 1576390 lock order. r=spohl This method is interacting with two different locks. We have debug code that makes sure that locking and unlocking across all locks is well-nested. Adding this scope makes sure that we unlock mCompositingState before we unlock mViewTearDownLock. Differential Revision: https://phabricator.services.mozilla.com/D53263
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1709,27 +1709,29 @@ bool nsChildView::PreRender(WidgetRender
   // compositing. That would make us unable to call postRender on it when the
   // composition is done, thus keeping the GL context locked forever.
   mViewTearDownLock.Lock();
 
   return true;
 }
 
 void nsChildView::PostRender(WidgetRenderingContext* aContext) {
-  auto compositingState = mCompositingState.Lock();
-  if (compositingState->mAsyncCATransactionsSuspended) {
-    // We should not trigger a CATransactions on this thread. Instead, let the
-    // main thread take care of calling ApplyChanges at an appropriate time.
-    compositingState->mNativeLayerChangesPending = true;
-  } else {
-    // Force a CoreAnimation layer tree update from this thread.
-    [NSAnimationContext beginGrouping];
-    mNativeLayerRoot->ApplyChanges();
-    compositingState->mNativeLayerChangesPending = false;
-    [NSAnimationContext endGrouping];
+  {  // scope for lock
+    auto compositingState = mCompositingState.Lock();
+    if (compositingState->mAsyncCATransactionsSuspended) {
+      // We should not trigger a CATransactions on this thread. Instead, let the
+      // main thread take care of calling ApplyChanges at an appropriate time.
+      compositingState->mNativeLayerChangesPending = true;
+    } else {
+      // Force a CoreAnimation layer tree update from this thread.
+      [NSAnimationContext beginGrouping];
+      mNativeLayerRoot->ApplyChanges();
+      compositingState->mNativeLayerChangesPending = false;
+      [NSAnimationContext endGrouping];
+    }
   }
   mViewTearDownLock.Unlock();
 }
 
 RefPtr<layers::NativeLayerRoot> nsChildView::GetNativeLayerRoot() { return mNativeLayerRoot; }
 
 static int32_t FindTitlebarBottom(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
                                   int32_t aWindowWidth) {