mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 01:47:31 +09:00
Issue #1905 - Part 2c - Fix OpenGL crash caused by calling [NSOpenGLContext setView:] on the Compositor thread. Starting with SDK 10.14 I believe, many functions have main thread checks, including setView: and update. So we now move the code in the updateGLContext method into doDrawRect which runs on the main thread.
This commit is contained in:
parent
d8e6867dad
commit
7224a17903
2 changed files with 8 additions and 13 deletions
|
|
@ -224,7 +224,6 @@ class WidgetRenderingContext;
|
||||||
enter:(BOOL)aEnter
|
enter:(BOOL)aEnter
|
||||||
exitFrom:(mozilla::WidgetMouseEvent::ExitFrom)aExitFrom;
|
exitFrom:(mozilla::WidgetMouseEvent::ExitFrom)aExitFrom;
|
||||||
|
|
||||||
- (void)updateGLContext;
|
|
||||||
- (void)_surfaceNeedsUpdate:(NSNotification*)notification;
|
- (void)_surfaceNeedsUpdate:(NSNotification*)notification;
|
||||||
|
|
||||||
- (bool)preRender:(NSOpenGLContext *)aGLContext;
|
- (bool)preRender:(NSOpenGLContext *)aGLContext;
|
||||||
|
|
|
||||||
|
|
@ -3309,16 +3309,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||||
if (!mGLContext) {
|
if (!mGLContext) {
|
||||||
mGLContext = aGLContext;
|
mGLContext = aGLContext;
|
||||||
[mGLContext retain];
|
[mGLContext retain];
|
||||||
mNeedsGLUpdate = true;
|
mNeedsGLUpdate = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLLockContext((CGLContextObj)[aGLContext CGLContextObj]);
|
CGLLockContext((CGLContextObj)[aGLContext CGLContextObj]);
|
||||||
|
|
||||||
if (mNeedsGLUpdate) {
|
|
||||||
[self updateGLContext];
|
|
||||||
mNeedsGLUpdate = NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||||
|
|
@ -3472,12 +3467,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)updateGLContext
|
|
||||||
{
|
|
||||||
[mGLContext setView:mPixelHostingView];
|
|
||||||
[mGLContext update];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)_surfaceNeedsUpdate:(NSNotification*)notification
|
- (void)_surfaceNeedsUpdate:(NSNotification*)notification
|
||||||
{
|
{
|
||||||
if (mGLContext) {
|
if (mGLContext) {
|
||||||
|
|
@ -3592,6 +3581,13 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||||
LayoutDeviceIntRegion region(geckoBounds);
|
LayoutDeviceIntRegion region(geckoBounds);
|
||||||
|
|
||||||
mGeckoChild->PaintWindow(region);
|
mGeckoChild->PaintWindow(region);
|
||||||
|
|
||||||
|
if (mNeedsGLUpdate) {
|
||||||
|
[mGLContext setView:mPixelHostingView];
|
||||||
|
[mGLContext update];
|
||||||
|
mNeedsGLUpdate = NO;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue