Bugzilla – Attachment 824 Details for
Bug 1398
[NSOpenGLContext setView:] must be executed on the main thread
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Moves OpenGL context manipulations to main thread
macos.jogl.patch (text/plain), 2.33 KB, created by
jani
on 2019-10-22 17:56:19 CEST
(
hide
)
Description:
Moves OpenGL context manipulations to main thread
Filename:
MIME Type:
Creator:
jani
Created:
2019-10-22 17:56:19 CEST
Size:
2.33 KB
patch
obsolete
>commit 758d11aa5ef44dd50a55599b6eed4a2aa8e11326 >Author: Jani Turkia <jani@nexcus.com> >Date: Mon Oct 21 18:36:24 2019 -0500 > > Moved manipulations of NSOpenGLContext and the NSView related to it to the main thread. > > In at least MacOS Catalina (10.15) the OpenGL context must be created and updated on the main thread only. > > This is from the crash report: > -[NSOpenGLContext setView:] must be called from the main thread. > >diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m >index 462b539..dacaea3 100644 >--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m >+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m >@@ -14,6 +14,8 @@ > #endif > */ > >+#include <dispatch/dispatch.h> >+ > #import "MacOSXWindowSystemInterface.h" > > #import "ContextUpdater.h" >@@ -556,7 +558,9 @@ NSOpenGLContext* createContext(NSOpenGLContext* share, > GLint zeroOpacity = 0; > [ctx setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity]; > } >- [ctx setView:view]; // Bug 1087: Set default framebuffer, hence enforce NSView realization >+ dispatch_async(dispatch_get_main_queue(), ^{ // Fix for MacOS Catalina: -[NSOpenGLContext setView:] must be called from the main thread. >+ [ctx setView:view]; // Bug 1087: Set default framebuffer, hence enforce NSView realization >+ }); > if( viewReadyAndLocked ) { > [view unlockFocus]; > } >@@ -574,7 +578,9 @@ void setContextView(NSOpenGLContext* ctx, NSView* view) { > Bool viewReadyAndLocked = lockViewIfReady(view); > DBG_PRINT("setContextView.0: ctx %p, view %p: setView: %d\n", ctx, view, viewReadyAndLocked); > if( viewReadyAndLocked ) { >- [ctx setView:view]; >+ dispatch_async(dispatch_get_main_queue(), ^{ >+ [ctx setView:view]; >+ }); > [view unlockFocus]; > } > } >@@ -655,7 +661,9 @@ void updateContext(NSOpenGLContext* ctx) { > NSView *nsView = [ctx view]; > if(NULL != nsView) { > DBG_PRINT("updateContext.0: ctx %p, ctx.view %p\n", ctx, nsView); >- [ctx update]; >+ dispatch_async(dispatch_get_main_queue(), ^{ >+ [ctx update]; >+ }); > DBG_PRINT("updateContext.X\n"); > } > [pool release];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1398
:
824
|
825
|
838
|
839
|
840
|
841
|
842
|
843
|
844