summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java18
2 files changed, 14 insertions, 6 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
index 894b9a201..eeb0b2504 100644
--- a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
@@ -78,6 +78,7 @@ public abstract class DisplayImpl extends Display {
display.name = name;
display.type=type;
display.destroyWhenUnused=false;
+ display.refCount=0;
synchronized(displayList) {
display.id = serialno++;
display.fqname = getFQName(display.id, display.type, display.name);
@@ -184,6 +185,7 @@ public abstract class DisplayImpl extends Display {
edtUtil.reset();
}
aDevice = null;
+ refCount=0;
if(DEBUG) {
dumpDisplayList("Display.destroy("+getFQName()+") END");
}
diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
index 3939a12fb..d3ff2e558 100644
--- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
@@ -513,13 +513,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void destroy(boolean unrecoverable) {
- if(DEBUG_IMPLEMENTATION) {
- String msg = new String("Window.destroy(unrecoverable: "+unrecoverable+") START "+getThreadName()/*+", "+this*/);
- System.err.println(msg);
- //Exception ee = new Exception(msg);
- //ee.printStackTrace();
+ if( isValid() ) {
+ if(DEBUG_IMPLEMENTATION) {
+ String msg = new String("Window.destroy(unrecoverable: "+unrecoverable+") START "+getThreadName()/*+", "+this*/);
+ System.err.println(msg);
+ //Exception ee = new Exception(msg);
+ //ee.printStackTrace();
+ }
+ runOnEDTIfAvail(true, new DestroyAction(unrecoverable));
}
- runOnEDTIfAvail(true, new DestroyAction(unrecoverable));
}
class DestroyAction implements Runnable {
@@ -530,6 +532,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public void run() {
windowLock.lock();
try {
+ if( !isValid() ) {
+ return; // nop
+ }
+
// Childs first ..
synchronized(childWindowsLock) {
// avoid ConcurrentModificationException: parent -> child -> parent.removeChild(this)