diff options
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface.m | 2 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m index 1eb3da96c..188d6d593 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m @@ -590,7 +590,7 @@ Bool deleteContext(void* nsJContext, Bool releaseOnMainThread) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [nsContext clearDrawable]; - if(releaseOnMainThread) { + if(releaseOnMainThread && NO == [NSThread isMainThread]) { [nsContext performSelectorOnMainThread:@selector(release:) withObject:nil waitUntilDone:YES]; } else { // would hangs for ~10s for 1 of the shared context, set releaseOnMainThread=true ! diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index ca303e6bc..cd558c05d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -35,7 +35,11 @@ public class OSXUtil { } public static void RunOnMainThread(boolean waitUntilDone, Runnable runnable) { - RunOnMainThread0(waitUntilDone, runnable); + if(IsMainThread0()) { + runnable.run(); // don't leave the JVM + } else { + RunOnMainThread0(waitUntilDone, runnable); + } } public static boolean IsMainThread() { |