From af772b40e65acdb021f9f9a08992595ddb1be815 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 5 Aug 2016 11:33:06 +1200 Subject: [PATCH] Bug 1292288 - Don't hold both the effects lock and the GL lock at the same time in PrepareWindowEffects to avoid deadlock. r=mstange --HG-- extra : rebase_source : f80ae0cfca630b7a414eea8921047996a9122104 --- widget/cocoa/nsChildView.mm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index fe8f5fab5d92..fff0b04ac792 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1994,23 +1994,27 @@ nsChildView::PrepareWindowEffects() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - MutexAutoLock lock(mEffectsLock); - mShowsResizeIndicator = ShowsResizeIndicator(&mResizeIndicatorRect); - mHasRoundedBottomCorners = [(ChildView*)mView hasRoundedBottomCorners]; - CGFloat cornerRadius = [(ChildView*)mView cornerRadius]; - mDevPixelCornerRadius = cornerRadius * BackingScaleFactor(); - mIsCoveringTitlebar = [(ChildView*)mView isCoveringTitlebar]; - NSInteger styleMask = [[mView window] styleMask]; - bool isFullscreen = (styleMask & NSFullScreenWindowMask) || !(styleMask & NSTitledWindowMask); + bool isFullscreen; + { + MutexAutoLock lock(mEffectsLock); + mShowsResizeIndicator = ShowsResizeIndicator(&mResizeIndicatorRect); + mHasRoundedBottomCorners = [(ChildView*)mView hasRoundedBottomCorners]; + CGFloat cornerRadius = [(ChildView*)mView cornerRadius]; + mDevPixelCornerRadius = cornerRadius * BackingScaleFactor(); + mIsCoveringTitlebar = [(ChildView*)mView isCoveringTitlebar]; + NSInteger styleMask = [[mView window] styleMask]; + isFullscreen = (styleMask & NSFullScreenWindowMask) || !(styleMask & NSTitledWindowMask); + if (mIsCoveringTitlebar) { + mTitlebarRect = RectContainingTitlebarControls(); + UpdateTitlebarCGContext(); + } + } + // If we've just transitioned into or out of full screen then update the opacity on our GLContext. if (isFullscreen != mIsFullscreen) { mIsFullscreen = isFullscreen; [(ChildView*)mView setFullscreen:isFullscreen]; } - if (mIsCoveringTitlebar) { - mTitlebarRect = RectContainingTitlebarControls(); - UpdateTitlebarCGContext(); - } NS_OBJC_END_TRY_ABORT_BLOCK; }