diff options
author | Sven Gothel <[email protected]> | 2015-07-27 20:05:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-07-27 20:05:09 +0200 |
commit | b0af5159bc6100a6262afe6b52f9092a207ac2b3 (patch) | |
tree | 8379e6a283fd3c5028889ef9ad0e96ed77c3c3c3 /src/nativewindow/classes/jogamp | |
parent | 6ae08be1742e6d805b316c0d440364854a49e68f (diff) |
Bug 1181 - JOGL WebStart Applications using GLCanvas/AWT may Deadlock by two AWT-EDT on Java >= 1.8.0_45
Root cause:
- AWT Toolkit global Lock
Our locking scheme (AWT-EDT-1):
- Surface Lock
- sun.awt.SunToolkit.awtLock()
- Component.getGraphicsConfiguration() -> synchronized(Component.getTreeLock())
Other AWT-EDT-2 by Webstart:
- synchronized(Component.getTreeLock())
- sun.awt.SunToolkit.awtLock()
Results in a deadlock.
Solution:
- Issue Component.getGraphicsConfiguration() before awtLock(),
where Component.getGraphicsConfiguration() is being used to
detect possible reconfiguration.
- Also use updated AWTGraphicsConfiguration's GraphicsConfiguration
if no 'new' detection is required.
Diffstat (limited to 'src/nativewindow/classes/jogamp')
3 files changed, 11 insertions, 6 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 6f3f1ed6b..264bdf9d3 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -41,6 +41,7 @@ package jogamp.nativewindow.jawt.macosx; import java.awt.Component; +import java.awt.GraphicsConfiguration; import java.nio.Buffer; import java.security.AccessController; import java.security.PrivilegedAction; @@ -242,7 +243,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - protected int lockSurfaceImpl() throws NativeWindowException { + protected int lockSurfaceImpl(final GraphicsConfiguration gc) throws NativeWindowException { int ret = NativeSurface.LOCK_SURFACE_NOT_READY; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { @@ -279,7 +280,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { unlockSurfaceImpl(); return NativeSurface.LOCK_SURFACE_NOT_READY; } - updateLockedData(dsi.getBounds()); + updateLockedData(dsi.getBounds(), gc); if (DEBUG && firstLock ) { dumpInfo(); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index a6c9452af..655dadd6b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -40,6 +40,8 @@ package jogamp.nativewindow.jawt.windows; +import java.awt.GraphicsConfiguration; + import com.jogamp.nativewindow.AbstractGraphicsConfiguration; import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.NativeWindow; @@ -72,7 +74,7 @@ public class WindowsJAWTWindow extends JAWTWindow { } @Override - protected int lockSurfaceImpl() throws NativeWindowException { + protected int lockSurfaceImpl(final GraphicsConfiguration gc) throws NativeWindowException { int ret = NativeSurface.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { @@ -99,7 +101,7 @@ public class WindowsJAWTWindow extends JAWTWindow { unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - updateLockedData(dsi.getBounds()); + updateLockedData(dsi.getBounds(), gc); win32dsi = (JAWT_Win32DrawingSurfaceInfo) dsi.platformInfo(getJAWT()); if (win32dsi == null) { unlockSurfaceImpl(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index 2620b60e0..80cf3ba6f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java @@ -37,6 +37,8 @@ package jogamp.nativewindow.jawt.x11; +import java.awt.GraphicsConfiguration; + import com.jogamp.nativewindow.AbstractGraphicsConfiguration; import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.NativeWindow; @@ -67,7 +69,7 @@ public class X11JAWTWindow extends JAWTWindow { } @Override - protected int lockSurfaceImpl() throws NativeWindowException { + protected int lockSurfaceImpl(final GraphicsConfiguration gc) throws NativeWindowException { int ret = NativeSurface.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { @@ -94,7 +96,7 @@ public class X11JAWTWindow extends JAWTWindow { unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - updateLockedData(dsi.getBounds()); + updateLockedData(dsi.getBounds(), gc); x11dsi = (JAWT_X11DrawingSurfaceInfo) dsi.platformInfo(getJAWT()); if (x11dsi == null) { unlockSurfaceImpl(); |