diff options
author | Sven Gothel <[email protected]> | 2019-12-06 02:07:59 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-06 02:07:59 +0100 |
commit | de13e49aadd4b4df09eb1ab37c84cda404586ba5 (patch) | |
tree | 8f77c20eff2c69ed22f98d8bec4681f1f97f3c19 | |
parent | 75afd5c6be7f68b32fbe9e5d319d888888b30719 (diff) |
Bug 1410: Fix NEWT PointerIcon Lifecycle (destroy and clean references @ closing)
Commit d5ba4cae824087879a4857e20961a95da04eaebb clarified and simplified the lifecycle of a PointerImpl instance, i.e. drop its resurrection in
PointerImpl.validateHandle() in favor of a hard exception.
This caused detection of subsequent PointerImpl lifecycle issues,
as instances were not fully destroyed on Display closing and
references not null'ed in Display and Screen instances.
-rw-r--r-- | make/scripts/tests.sh | 20 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java | 11 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java | 34 |
3 files changed, 47 insertions, 18 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 40960e56e..fc9fb0355 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -101,6 +101,15 @@ function jrun() { swton=$1 shift + #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false" + #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false" + #X_ARGS="-verbose:jni" + #X_ARGS="-Xcheck:jni" + #X_ARGS="-Xcheck:jni -verbose:jni" + #X_ARGS="-Xrs" + #X_ARGS="-Dsun.awt.disableMixing=true" + #X_ARGS="--illegal-access=warn" + #D_ARGS="-Djogl.debug.GLProfile -Djogl.debug.GLContext" #D_ARGS="-Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.DebugGL" @@ -120,6 +129,9 @@ function jrun() { #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Dnewt.disable.LinuxKeyEventTracker -Dnewt.disable.LinuxMouseTracker" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Dnewt.disable.LinuxKeyEventTracker" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Dnewt.disable.LinuxMouseTracker" + #D_ARGS="-Dnewt.debug.Display.PointerIcon -Dnewt.debug.Window.KeyEvent -Dnewt.disable.PointerIcon" + #D_ARGS="-Dnewt.debug.Display.PointerIcon -Dnewt.debug.Window.KeyEvent" + #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" @@ -131,7 +143,6 @@ function jrun() { #D_ARGS="-Dnewt.debug.Window" #D_ARGS="-Dnewt.debug.Window -Djogamp.common.utils.locks.Lock.timeout=600000 -Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.EDT -Djogamp.common.utils.locks.Lock.timeout=600000 -Dnativewindow.debug.OSXUtil.MainThreadChecker" - #X_ARGS="--illegal-access=warn" #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true" #D_ARGS="-Djogl.debug.GLContext -Djogamp.debug.NativeLibrary -Djogamp.debug.JNILibLoader -Djogl.debug.DebugGL -Djogl.debug.GLDebugMessageHandler" @@ -332,13 +343,6 @@ function jrun() { #D_ARGS="-Djogl.debug.PNG -Dnewt.debug.Display.PointerIcon" #D_ARGS="-Djogl.debug.JPEGImage -Djogamp.debug.Bitstream" #D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser" - #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false" - #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false" - #X_ARGS="-verbose:jni" - #X_ARGS="-Xcheck:jni" - #X_ARGS="-Xcheck:jni -verbose:jni" - #X_ARGS="-Xrs" - #X_ARGS="-Dsun.awt.disableMixing=true" #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true -Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer" diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java index 335da25ca..ea42c27af 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java @@ -107,14 +107,23 @@ public class DisplayDriver extends DisplayImpl { defaultPointerIcon = null; } - if( DEBUG_POINTER_ICON ) { + if( DEBUG ) { System.err.println("Display.createNativeImpl: "+this); + } + if( DEBUG_POINTER_ICON ) { System.err.println("Display.createNativeImpl: defaultPointerIcon "+defaultPointerIcon); } } @Override protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { + if( DEBUG ) { + System.err.println("Display.closeNativeImpl: "+this); + } + if( null != defaultPointerIcon ) { + defaultPointerIcon.destroy(); + defaultPointerIcon = null; + } aDevice.close(); DRMLib.gbm_device_destroy(gbmHandle); gbmHandle = 0; diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java index 2e1b88c47..eb0b93f3e 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java @@ -59,12 +59,24 @@ public class ScreenDriver extends ScreenImpl { if( DEBUG ) { drmMode.print(System.err); } - defaultPointerIcon = ((DisplayDriver)display).defaultPointerIcon; + synchronized(pointerIconSync) { + defaultPointerIcon = ((DisplayDriver)display).defaultPointerIcon; + } + if( DEBUG ) { + System.err.println("Screen.createNativeImpl: "+this); + } } @Override protected void closeNativeImpl() { - defaultPointerIcon = null; + if( DEBUG ) { + System.err.println("Screen.closeNativeImpl: "+this); + } + synchronized(pointerIconSync) { + defaultPointerIcon = null; + activePointerIcon = null; + activePointerIconVisible = false; + } drmMode.destroy(); drmMode = null; } @@ -119,12 +131,16 @@ public class ScreenDriver extends ScreenImpl { MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null); crtc_ids = new int[] { encoder[scridx].getCrtc_id() }; - if( null != defaultPointerIcon ) { - final LinuxMouseTracker lmt = LinuxMouseTracker.getSingleton(); - if( null != lmt ) { - setPointerIconActive(defaultPointerIcon, lmt.getLastX(), lmt.getLastY()); - } else { - setPointerIconActive(defaultPointerIcon, 0, 0); + + synchronized(pointerIconSync) { + // requires crtc_ids[] to be set! + if( null != defaultPointerIcon ) { + final LinuxMouseTracker lmt = LinuxMouseTracker.getSingleton(); + if( null != lmt ) { + setPointerIconActive(defaultPointerIcon, lmt.getLastX(), lmt.getLastY()); + } else { + setPointerIconActive(defaultPointerIcon, 0, 0); + } } } } @@ -209,8 +225,8 @@ public class ScreenDriver extends ScreenImpl { protected native void initNative(long drmHandle); protected int[] crtc_ids; + private final Object pointerIconSync = new Object(); private PointerIconImpl activePointerIcon; private boolean activePointerIconVisible; - private final Object pointerIconSync = new Object(); private PointerIconImpl defaultPointerIcon = null; } |