aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-09-26 02:32:02 +0200
committerSven Gothel <[email protected]>2010-09-26 02:32:02 +0200
commit8a850ea69d90fa68efecb52ba8dc6ec3938505d7 (patch)
tree1f1e23d7a2e46f7a38716abf9f274a2e0f043670 /src/newt/classes/com/jogamp
parenta831e7d5c5a9c1e82f70713f7d07946cfc562041 (diff)
NEWT: Fix WindowImpl: Bring back 'isValid()' test no screen!=null in destroy() ; DisplayImpl: refCount reset
Diffstat (limited to 'src/newt/classes/com/jogamp')
-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)