From a4e3f241cfba55e407c68eba91ffcc4beb0758b5 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 26 Oct 2010 23:23:39 +0200
Subject: Analysis of glXMakeCurrent freeze on ATI fglrx 8.78.6; Misc ..

Analysis of glXMakeCurrent freeze on ATI fglrx 8.78.6
    - Workaround in TestGLWindows01NEWT: same create/destroy order
    - Prove bug with simple native test app: jogl/test/native/displayMultiple02.c

Misc:
    - Reverted d52181032830acdd5e4069a41ccd0daff5922d8a, ie reenable x11IOErrorHandler (nativewindow)
    - GLDrawableHelper: methods -> final
    - X11Util.NamedDisplay: remove unused RecursiveLock, Cloneable
---
 .../com/jogamp/nativewindow/impl/x11/X11Util.java   | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

(limited to 'src/nativewindow/classes/com')

diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
index 5e89e9f50..14e285187 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
@@ -126,7 +126,7 @@ public class X11Util {
 
     private static ThreadLocal currentDisplayMap = new ThreadLocal();
 
-    public static class NamedDisplay extends RecursiveLock implements Cloneable {
+    public static class NamedDisplay {
         String name;
         long   handle;
         int    refCount;
@@ -142,6 +142,8 @@ public class X11Util {
         public final String getName() { return name; }
         public final long   getHandle() { return handle; }
         public final int    getRefCount() { return refCount; }
+
+        public void setUncloseable(boolean v) { unCloseable = v; }
         public final boolean isUncloseable() { return unCloseable; }
 
         public Object clone() throws CloneNotSupportedException {
@@ -158,9 +160,9 @@ public class X11Util {
       */
     public static int shutdown(boolean realXClosePendingDisplays, boolean verbose) {
         int num=0;
-        String msg = null;
         if(DEBUG||verbose) {
-            msg = "X11Util.Display: Shutdown (global: "+globalNamedDisplayMap.size()+ ")" ;
+            String msg = "X11Util.Display: Shutdown (closePendingDisplays: "+realXClosePendingDisplays+
+                         ", global: "+globalNamedDisplayMap.size()+ ")" ;
             if(DEBUG) {
                 Exception e = new Exception(msg);
                 e.printStackTrace();
@@ -269,7 +271,7 @@ public class X11Util {
             ndpy = (NamedDisplay) globalNamedDisplayMap.get(handle);
         }
         if( null != ndpy ) {
-            ndpy.unCloseable=true;
+            ndpy.setUncloseable(true);
             return true;
         }
         return false;
@@ -355,11 +357,22 @@ public class X11Util {
             throw new RuntimeException("X11Util.Display: Display(0x"+Long.toHexString(handle)+") Mapping error: "+namedDpy+". Thread "+Thread.currentThread().getName());
         }
 
+        if(DEBUG) {
+            Exception e = new Exception("X11Util.Display: Closing new "+namedDpy+". Thread "+Thread.currentThread().getName());
+            e.printStackTrace();
+        }
+
         if(!namedDpy.isUncloseable()) {
             XCloseDisplay(namedDpy.getHandle());
         }
     }
 
+    public static NamedDisplay getNamedDisplay(long handle) {
+        synchronized(globalLock) {
+            return (NamedDisplay) globalNamedDisplayMap.get(handle);
+        }
+    }
+
     /** 
      * @return If name is null, it returns the previous queried NULL display name,
      * otherwise the name. */
-- 
cgit v1.2.3