diff options
author | Sven Gothel <[email protected]> | 2015-07-28 00:37:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-07-28 00:37:53 +0200 |
commit | 4eeddd0d446f8491dde2e5b0e3e11e0d5b0be9b7 (patch) | |
tree | c96f168eee0b4a221ce5fb3c7a549c22555a008f /src/nativewindow | |
parent | b0af5159bc6100a6262afe6b52f9092a207ac2b3 (diff) |
Bug 1161 - Fix Canvas resize stops the rendering in Mac OS X (mostly from WebStart)
Root cause:
JAWTWindow's JAWTComponentListener 'isShowing'
state is initialized while attaching it on-thread
and updated via hierarchy-changed event.
JAWTComponentListener attachment to the component
is issued at JAWTWindow's creation but on the AWT-EDT,
hence it may happen at a later time.
In this bug scenario, it happens very late,
so that the hierarchy-changed event is missed
and 'isShowing' is never set to 'true'.
Solution is to update 'isShowing' state
on the actual AWT-EDT when attaching to the component.
Also make 'isShowing' volatile.
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 3eece0759..294e57bd3 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -137,7 +137,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private String jawtStr() { return "JAWTWindow["+id(JAWTWindow.this)+"]"; } private class JAWTComponentListener implements ComponentListener, HierarchyListener { - private boolean isShowing; + private volatile boolean isShowing; private String str(final Object obj) { if( null == obj ) { @@ -178,6 +178,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, AWTEDTExecutor.singleton.invoke(false, new Runnable() { // Bug 952: Avoid deadlock via AWTTreeLock acquisition .. @Override public void run() { + isShowing = component.isShowing(); // Bug 1161: Runnable might be deferred, hence need to update if(DEBUG) { System.err.println(jawtStr()+".attach @ Thread "+getThreadName()+": "+JAWTComponentListener.this.toString()); } @@ -247,7 +248,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, final java.awt.Component changed = e.getChanged(); final boolean displayable = changed.isDisplayable(); final boolean showing = changed.isShowing(); - System.err.println(jawtStr()+".hierarchyChanged: action "+action+", displayable "+displayable+", showing [changed "+showing+", comp "+isShowing+"], "+s(e)); + System.err.println(jawtStr()+".hierarchyChanged: action "+action+", displayable "+displayable+", showing [changed "+showing+", comp "+wasShowing+" -> "+isShowing+"], "+s(e)); } } } |