diff options
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java index 34bc48f99..45146d33e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java @@ -56,9 +56,14 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl /** Creates a new X11GraphicsScreen using a thread local display connection */ public static AbstractGraphicsScreen createDefault() { - long display = X11Util.getThreadLocalDefaultDisplay(); - int scrnIdx = X11Lib.DefaultScreen(display); - return createScreenDevice(display, scrnIdx); + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + long display = X11Util.getThreadLocalDefaultDisplay(); + int scrnIdx = X11Lib.DefaultScreen(display); + return createScreenDevice(display, scrnIdx); + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); + } } public long getDefaultVisualID() { @@ -74,8 +79,14 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl } private static int fetchScreen(X11GraphicsDevice device, int screen) { - if(!X11Lib.XineramaEnabled(device.getHandle())) { - return screen; + // It still could be an AWT hold handle .. + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + if(!X11Lib.XineramaEnabled(device.getHandle())) { + return screen; + } + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } return 0; } |