Package: xlibs-data
Version: 4.3.0-7
Severity: normal
Followup-For: Bug #147898

Hi,

this bug has been fixed upstream, see
  http://bugzilla.xfree86.org/show_bug.cgi?id=260
This bugreport contains a backported fix from Mdk for XFree86 4.3.0,
and here is another one shipped by RH (4.3.0-55).
I cannot test these patches myself.

Denis
Created by Mike A. Harris <[EMAIL PROTECTED]>

This patch is backported from post 4.3.0 CVS from cvsps patchset 11329.
This patch fixes XFree86 bugzilla bug #260



---------------------
PatchSet 11329 
Date: 2003/07/07 16:34:20
Author: eich
Branch: HEAD
Tag: (none) 
Log:
 282. Fixing deadlock in libXi - when is called _XLockDisplay() twice - when
      calling a Xi function that calls XGetExtensionVersion() (Bugzilla #260,
      Bastien Nocera, Owen Taylor).

Members: 
        lib/Xi/XExtInt.c:3.7->3.8 
        lib/Xi/XGetVers.c:3.4->3.5 
        lib/Xi/XIint.h:3.1->3.2 

diff -u xc/lib/Xi/XExtInt.c:3.7 xc/lib/Xi/XExtInt.c:3.8
--- xc/lib/Xi/XExtInt.c:3.7     Tue Oct 15 20:37:28 2002
+++ xc/lib/Xi/XExtInt.c Mon Jul  7 11:34:22 2003
@@ -196,7 +196,7 @@
            return (-1);
            }
        ((XInputData *) info->data)->vers =
-           XGetExtensionVersion (dpy, "XInputExtension");
+           _XiGetExtensionVersion (dpy, "XInputExtension");
        }
 
     if (versions[version_index].major_version > Dont_Check)
diff -u xc/lib/Xi/XGetVers.c:3.4 xc/lib/Xi/XGetVers.c:3.5
--- xc/lib/Xi/XGetVers.c:3.4    Tue Oct 15 20:37:29 2002
+++ xc/lib/Xi/XGetVers.c        Mon Jul  7 11:34:22 2003
@@ -71,12 +71,33 @@
     char               *name;
 #endif
     {       
+    XExtensionVersion          *ext;
+
+    LockDisplay (dpy);
+    ext = _XiGetExtensionVersion (dpy, name);
+    if (ext != NoSuchExtension) { /* This is unlocked in _XiCheckExtInit() */
+       UnlockDisplay (dpy);
+       SyncHandle();
+    }
+    return (ext);
+    }
+
+XExtensionVersion
+#if NeedFunctionPrototypes
+*_XiGetExtensionVersion (
+    register Display   *dpy,
+    _Xconst char       *name)
+#else
+*_XiGetExtensionVersion (dpy, name)
+    register Display   *dpy;
+    char               *name;
+#endif
+    {       
     xGetExtensionVersionReq    *req;
     xGetExtensionVersionReply  rep;
     XExtensionVersion          *ext;
     XExtDisplayInfo *info = XInput_find_display (dpy);
 
-    LockDisplay (dpy);
     if (_XiCheckExtInit(dpy, Dont_Check) == -1)
        return ((XExtensionVersion *) NoSuchExtension);
 
@@ -89,8 +110,6 @@
 
     if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) 
        {
-       UnlockDisplay(dpy);
-       SyncHandle();
        return (XExtensionVersion *) NULL;
        }
     ext = (XExtensionVersion *) Xmalloc (sizeof (XExtensionVersion));
@@ -103,8 +122,6 @@
            ext->minor_version = rep.minor_version;
            }
        }
-    UnlockDisplay(dpy);
-    SyncHandle();
     return (ext);
     }
 
diff -u xc/lib/Xi/XIint.h:3.1 xc/lib/Xi/XIint.h:3.2
--- xc/lib/Xi/XIint.h:3.1       Tue Jul 31 20:44:39 2001
+++ xc/lib/Xi/XIint.h   Mon Jul  7 11:34:22 2003
@@ -21,4 +21,11 @@
 #endif
 );
 
+extern XExtensionVersion * _XiGetExtensionVersion(
+#if NeedFunctionPrototypes
+       Display*,
+       _Xconst char*
+#endif
+);
+
 #endif

Reply via email to