summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTUsageBeforeJOGLInitBug411.java5
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java18
3 files changed, 19 insertions, 6 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTUsageBeforeJOGLInitBug411.java
index 6dea35769..ac6b61586 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTUsageBeforeJOGLInitBug411.java
@@ -294,6 +294,9 @@ public class TestSwingAWTUsageBeforeJOGLInitBug411 {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
+ GLWindow winDummy = GLWindow.create(caps);
+ winDummy.addGLEventListener(new Gears());
+
GLWindow win0 = GLWindow.create(caps);
win0.setSize(100,100);
win0.setVisible(true);
@@ -306,6 +309,8 @@ public class TestSwingAWTUsageBeforeJOGLInitBug411 {
runTestGL(newtCanvasAWT, (GLAutoDrawable)newtCanvasAWT.getNEWTChild());
newtCanvasAWT.destroy(true);
+ winDummy.destroy(true);
+
anim0.stop();
win0.destroy(true);
}
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)