diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 07be602f7b33..55b41d73209a 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -156,7 +156,9 @@ class WidgetRenderingContext; BOOL mExpectingWheelStop; // Set to YES when our GL surface has been updated and we need to call - // updateGLContext before we composite. + // updateGLContext on the compositor thread before we composite. + // Accesses from different threads are synchronized via mGLContext's + // CGLContextObj lock. BOOL mNeedsGLUpdate; // Holds our drag service across multiple drag calls. The reference to the @@ -166,6 +168,7 @@ class WidgetRenderingContext; // when handling |draggingUpdated:| messages. nsIDragService* mDragService; + // The NSOpenGLContext that is attached to our mPixelHostingView. NSOpenGLContext* mGLContext; // Gestures support diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 249ea2da93f7..74da6e2f5727 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2802,7 +2802,6 @@ class WidgetsReleaserRunnable final : public mozilla::Runnable { } @end -; @implementation ChildView @@ -2994,14 +2993,14 @@ NSEvent* gLastDragMouseDownEvent = nil; return false; } + CGLLockContext((CGLContextObj)[aGLContext CGLContextObj]); + if (!mGLContext) { mGLContext = aGLContext; [mGLContext retain]; - mNeedsGLUpdate = true; + mNeedsGLUpdate = YES; } - CGLLockContext((CGLContextObj)[aGLContext CGLContextObj]); - if (mNeedsGLUpdate) { [self updateGLContext]; mNeedsGLUpdate = NO;