diff options
author | Sven Gothel <[email protected]> | 2011-09-09 15:34:01 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-09 15:34:01 +0200 |
commit | 2083ba25be5ce9b55cc2f5a420f17c3bb5ff1750 (patch) | |
tree | 85f0b25ac223f075f8795fdc33365ce2ec38a0b8 /src/nativewindow/classes | |
parent | 4191e406178cdd900030a1ec3919476aab527734 (diff) |
X11Util: Catch X11 Error on XCloseDisplay
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index ec4602836..5c1839250 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -408,6 +408,10 @@ public class X11Util { if(!openDisplayList.remove(namedDpy)) { throw new RuntimeException("Internal: "+namedDpy); } if(!namedDpy.isUncloseable()) { + if(DEBUG) { + System.err.println("X11Util.Display: XCloseDisplay "+namedDpy+". Thread "+Thread.currentThread().getName()); + Thread.dumpStack(); + } XCloseDisplay(namedDpy.getHandle()); } else { // for reuse @@ -415,8 +419,7 @@ public class X11Util { } if(DEBUG) { - Exception e = new Exception("X11Util.Display: Closing new "+namedDpy+". Thread "+Thread.currentThread().getName()); - e.printStackTrace(); + System.err.println("X11Util.Display: Closed (real: "+(!namedDpy.isUncloseable())+") "+namedDpy+". Thread "+Thread.currentThread().getName()); } } } @@ -468,7 +471,17 @@ public class X11Util { Throwable t = new Throwable(Thread.currentThread()+" - X11Util.XCloseDisplay() 0x"+Long.toHexString(display)); t.printStackTrace(); } - return X11Lib.XCloseDisplay(display); + int res = -1; + X11Util.setX11ErrorHandler(true, DEBUG ? false : true); + try { + res = X11Lib.XCloseDisplay(display); + } catch (Exception ex) { + System.err.println("X11Util: Catched Exception:"); + ex.printStackTrace(); + } finally { + X11Util.setX11ErrorHandler(false, false); + } + return res; } finally { NativeWindowFactory.getDefaultToolkitLock().unlock(); } |