Bug 1398 - OpenGL context operations must be executed on the main thread
Summary: OpenGL context operations must be executed on the main thread
Status: IN_PROGRESS
Alias: None
Product: Jogl
Classification: JogAmp
Component: macosx (show other bugs)
Version: 2.4.0
Hardware: All macosx
: P4 major
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2019-10-22 17:48 CEST by jani
Modified: 2019-11-29 02:53 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments
Moves OpenGL context manipulations to main thread (2.33 KB, patch)
2019-10-22 17:56 CEST, jani
Details | Diff
Corrected patch to also work on macOS 10.8 (2.09 KB, patch)
2019-11-19 22:14 CET, jani
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jani 2019-10-22 17:48:20 CEST
Crashed Thread:        4

Exception Type:        EXC_BAD_INSTRUCTION (SIGABRT)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
-[NSOpenGLContext setView:] must be called from the main thread.

Thread 4 Crashed:
0   libsystem_kernel.dylib        	0x00007fff6eec547a __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff6ef82707 pthread_kill + 384
2   libsystem_c.dylib             	0x00007fff6ee4da08 abort + 120
3   libjvm.dylib                  	0x000000011fd1daa1 os::abort(bool) + 25
4   libjvm.dylib                  	0x000000011fe45e96 VMError::report_and_die() + 2304
5   libjvm.dylib                  	0x000000011fd1f6e6 JVM_handle_bsd_signal + 1131
6   libjvm.dylib                  	0x000000011fd1b92b signalHandler(int, __siginfo*, void*) + 47
7   libsystem_platform.dylib      	0x00007fff6ef77b1d _sigtramp + 29
8   com.apple.GeForceGLDriver     	0x00007fff3259720c 0x7fff32299000 + 3138060
9   libjogl_desktop.dylib         	0x0000000134ca3474 createContext + 388
10  libjogl_desktop.dylib         	0x0000000134d0a8c5 Java_jogamp_opengl_macosx_cgl_CGL_createContext0__JJZJZLjava_lang_Object_2I + 149


This also occurs in updateContext and setContextView.
Comment 1 jani 2019-10-22 17:50:47 CEST
BTW, this occurs on MacOS Catalina (10.15).
Comment 2 jani 2019-10-22 17:56:19 CEST
Created attachment 824 [details]
Moves OpenGL context manipulations to main thread
Comment 3 jani 2019-11-19 22:14:50 CET
Created attachment 825 [details]
Corrected patch to also work on macOS 10.8

On macOS 10.8 resources may get released prior to the code block executing on the main thread causing objc_msgSend to a deallocated instance.
Comment 4 Sven Gothel 2019-11-29 02:53:24 CET
Thank you. 
AFAIK I have already resolved this issue in one of my latest commits.
I will check this soon.
Earmarked for version 2.4.0 ofc.