diff options
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index a4dfe1c04..a57dafc92 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -163,19 +163,27 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private JAWTComponentListener() { isShowing = component.isShowing(); - if(DEBUG) { - System.err.println(jawtStr()+".attach @ Thread "+getThreadName()+": "+toString()); - } - component.addComponentListener(this); - component.addHierarchyListener(this); + AWTEDTExecutor.singleton.invoke(false, new Runnable() { // Bug 952: Avoid deadlock via AWTTreeLock acquisition .. + @Override + public void run() { + if(DEBUG) { + System.err.println(jawtStr()+".attach @ Thread "+getThreadName()+": "+JAWTComponentListener.this.toString()); + } + component.addComponentListener(JAWTComponentListener.this); + component.addHierarchyListener(JAWTComponentListener.this); + } } ); } private final void detach() { - if(DEBUG) { - System.err.println(jawtStr()+".detach @ Thread "+getThreadName()+": "+toString()); - } - component.removeComponentListener(this); - component.removeHierarchyListener(this); + AWTEDTExecutor.singleton.invoke(false, new Runnable() { // Bug 952: Avoid deadlock via AWTTreeLock acquisition .. + @Override + public void run() { + if(DEBUG) { + System.err.println(jawtStr()+".detach @ Thread "+getThreadName()+": "+JAWTComponentListener.this.toString()); + } + component.removeComponentListener(JAWTComponentListener.this); + component.removeHierarchyListener(JAWTComponentListener.this); + } } ); } @Override @@ -601,6 +609,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, public void destroy() { surfaceLock.lock(); try { + if(DEBUG) { + System.err.println(jawtStr()+".destroy @ Thread "+getThreadName()); + } jawtComponentListener.detach(); invalidate(); } finally { |