summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-07 07:47:12 +0200
committerSven Gothel <[email protected]>2013-10-07 07:47:12 +0200
commitc2a4905ec926362a08f486a68d428fb139821df1 (patch)
tree51fb1da6d62e4ff703104c5f07b42f60236f670a /src/newt/classes/jogamp
parent929cae9a5ba01a382d17387ff289d74ee029f090 (diff)
NEWT/OSX (Bug 836): Lifecycle operations performed on main-thread must be synchronized (wait-until-done)
Wait-until-done (main thread): - WindowDriver.close0(..) - WindowDriver.initWindow0(..) Otherwise a re-queued operation (i.e. CALayer attachment) will mixup the order .. Experienced w/ fullscreen exit.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 6aebf0410..d973c9005 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -86,7 +86,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
sscSurfaceHandle = 0;
isOffscreenInstance = false;
if (0 != handle) {
- OSXUtil.RunOnMainThread(false, new Runnable() {
+ OSXUtil.RunOnMainThread(true, new Runnable() {
public void run() {
close0( handle );
} } );
@@ -452,27 +452,28 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final PointImmutable pS, final int width, final int height,
final boolean fullscreen, final boolean visible, final boolean alwaysOnTop) {
+ final long parentWinHandle = getParentWindowHandle();
+ final long preWinHandle = getWindowHandle();
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+
": offscreen "+offscreenInstance+", recreate "+recreate+
", pS "+pS+", "+width+"x"+height+", fullscreen "+fullscreen+", visible "+visible+
- ", alwaysOnTop "+alwaysOnTop);
+ ", alwaysOnTop "+alwaysOnTop+", preWinHandle "+toHexString(preWinHandle)+", parentWin "+toHexString(parentWinHandle)+
+ ", surfaceHandle "+toHexString(surfaceHandle));
// Thread.dumpStack();
}
try {
- final long parentWin = getParentWindowHandle();
- if( 0 != getWindowHandle() ) {
- final long thisWin = getWindowHandle();
+ if( 0 != preWinHandle ) {
setWindowHandle(0);
-
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView");
}
- OSXUtil.RunOnMainThread(false, new Runnable() {
+ OSXUtil.RunOnMainThread(true, new Runnable() {
public void run() {
- changeContentView0(parentWin, thisWin, 0);
- close0( thisWin );
+ changeContentView0(parentWinHandle, preWinHandle, 0);
+ close0( preWinHandle );
} } );
} else {
if( 0 != surfaceHandle ) {
@@ -494,13 +495,13 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
setWindowHandle( newWin );
final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance;
- // Non blocking initialization on main-thread!
- OSXUtil.RunOnMainThread(false, new Runnable() {
+ // Blocking initialization on main-thread!
+ OSXUtil.RunOnMainThread(true, new Runnable() {
public void run() {
- initWindow0( parentWin, newWin, pS.getX(), pS.getY(), width, height,
+ initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height,
isOpaque, fullscreen, visible && !offscreenInstance, surfaceHandle);
if( offscreenInstance ) {
- orderOut0(0!=parentWin ? parentWin : newWin);
+ orderOut0(0!=parentWinHandle ? parentWinHandle : newWin);
} else {
setTitle0(newWin, getTitle());
setAlwaysOnTop0(getWindowHandle(), alwaysOnTop);