summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-06 02:07:59 +0100
committerSven Gothel <[email protected]>2019-12-06 02:07:59 +0100
commitde13e49aadd4b4df09eb1ab37c84cda404586ba5 (patch)
tree8f77c20eff2c69ed22f98d8bec4681f1f97f3c19 /src
parent75afd5c6be7f68b32fbe9e5d319d888888b30719 (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.
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java11
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java34
2 files changed, 35 insertions, 10 deletions
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;
}