diff options
author | Sven Gothel <[email protected]> | 2023-01-22 01:27:23 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-22 01:27:23 +0100 |
commit | 9829550f5bcb586f94f98f6d3c39f4d78fd78f3b (patch) | |
tree | e59f6d662b62ffeec6302d309cb6b808da2fd9bc /src | |
parent | 470a0ff3a2efbe43404d5f80a403efb38005598a (diff) |
MacOS: JAWTWindow.invalidateNative(): Use copied references in off-thread operations and zero source references upfront.
Have user being aware of disposal then triggered and not later when performed on MacOS main-thread
Diffstat (limited to 'src')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 278ed8a00..aeb623669 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -63,7 +63,6 @@ import jogamp.nativewindow.jawt.JAWTFactory; import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.nativewindow.jawt.JAWT_DrawingSurface; import jogamp.nativewindow.jawt.JAWT_DrawingSurfaceInfo; -import jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo; import jogamp.nativewindow.macosx.OSXUtil; public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { @@ -99,20 +98,23 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { if(0 != windowHandle) { OSXUtil.DestroyNSWindow(windowHandle); } - OSXUtil.RunOnMainThread(false, true /* kickNSApp */, new Runnable() { + final long _rootSurfaceLayer = rootSurfaceLayer; + rootSurfaceLayer = 0; + final long _jawtSurfaceLayersHandle = jawtSurfaceLayersHandle; + jawtSurfaceLayersHandle = 0; + OSXUtil.RunOnMainThread(false /* wait */, true /* kickNSApp */, new Runnable() { @Override public void run() { - if( 0 != _offscreenSurfaceLayer ) { // Bug 1389 - OSXUtil.RemoveCASublayer(rootSurfaceLayer, _offscreenSurfaceLayer, true); + if( 0 != _rootSurfaceLayer && 0 != _offscreenSurfaceLayer ) { // Bug 1389 + // throws if null == _rootSurfaceLayer + OSXUtil.RemoveCASublayer(_rootSurfaceLayer, _offscreenSurfaceLayer, true); } - if( 0 != jawtSurfaceLayersHandle) { + if( 0 != _jawtSurfaceLayersHandle) { // null rootSurfaceLayer OK - UnsetJAWTRootSurfaceLayer0(jawtSurfaceLayersHandle, rootSurfaceLayer); + UnsetJAWTRootSurfaceLayer0(_jawtSurfaceLayersHandle, _rootSurfaceLayer); } - jawtSurfaceLayersHandle = 0; - if( 0 != rootSurfaceLayer ) { - OSXUtil.DestroyCALayer(rootSurfaceLayer); - rootSurfaceLayer = 0; + if( 0 != _rootSurfaceLayer ) { + OSXUtil.DestroyCALayer(_rootSurfaceLayer); } } }); |