diff options
author | Sven Gothel <[email protected]> | 2012-06-30 15:44:55 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-06-30 15:44:55 +0200 |
commit | 5c83989b8bb8e8f9cbc25f09e6a6fe5847e6b94c (patch) | |
tree | 5ff6f7b961b8e3cfe75c6e26e813da8695a79ade /src/nativewindow/classes | |
parent | 9a7c8896fe38ebcd42ed5238b09a7a36d46db9dc (diff) |
Fix Bug 597: XDisplayString(0) -> SIGSEGV; Handle n/a DISPLAY
It works now as follows:
Note: Remote connection tested using ssh to localhost or an actual remote
machine.
Test w/ proper X11 authentication, i.e. DISPLAY and xauth:
> cd projects/JOGL/jogl-bugs/597-headless/
> echo $DISPLAY
localhost:10.0
> xclock
'works'
T1.1 OK> java plop
jogamp.opengl.x11.glx.X11GLXDrawableFactory@f581593
T1.2 OK> java -Djava.awt.headless=true plop
jogamp.opengl.x11.glx.X11GLXDrawableFactory@6f34a7d8
+++
Test _without_ proper X11 authentication, i.e. DISPLAY and xauth:
> xclock
No protocol specified
No protocol specified
Error: Can't open display: :0.0
T2.1 OK> java plop
No protocol specified
No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window
server using ':0.0' as the value of the DISPLAY variable.
(Stack trace from:
GLProfile.initProfilesForDefaultDevices(..) ->
NativeWindowFactory.initSingleton(..) ->
JAWTUtil.<clinit>->
sun.awt.X11.XToolkit.<clinit> ->
sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
T2.2 OK> java -Djava.awt.headless=true plop
No protocol specified
No protocol specified
...
jogamp.opengl.x11.glx.X11GLXDrawableFactory@394a8cd1
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index c42bcf816..3c197062a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -109,10 +109,14 @@ public class X11Util { isX11LockAvailable = isXInitThreadsOK && !HAS_XLOCKDISPLAY_BUG ; final long dpy = X11Lib.XOpenDisplay(null); - try { - nullDisplayName = X11Lib.XDisplayString(dpy); - } finally { - X11Lib.XCloseDisplay(dpy); + if(0 != dpy) { + try { + nullDisplayName = X11Lib.XDisplayString(dpy); + } finally { + X11Lib.XCloseDisplay(dpy); + } + } else { + nullDisplayName = "nil"; } if(DEBUG) { |