Bug 5424 - Deadlock in XGetExtensionVersion() when XInitThreads() is called before
Summary: Deadlock in XGetExtensionVersion() when XInitThreads() is called before
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xi (show other bugs)
Version: 6.9.0
Hardware: x86 (IA32) Linux (All)
: high critical
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 1413 5423 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-26 11:25 UTC by Felix Hädicke
Modified: 2011-09-24 23:00 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Port of XFree's patch (for X.org 6.9) (787 bytes, patch)
2005-12-26 12:29 UTC, Felix Hädicke
no flags Details | Splinter Review

Description Felix Hädicke 2005-12-26 11:25:04 UTC
There is a bug that calling XGetExtensionVersion() after XInitThreads() always   
causes a deadlock.   
   
I do not really use XGetExtensionVersion() myself, but I found a deadlock in  
the Qt library in the QApplication constructor, and this seems to be caused by   
XGetExtensionVersion() and happens only if XInitThreads() is called before.   
According to this forum posting (which is probably the same bug):   
http://www.qt-forum.org/thread.php?threadid=14988&sid=e99b9990f5fbbec62dc5e650d36b160f&hilight=XInitThreads   
this did not happen in XFree 4.3 - but I have not tried this myself, so I  
cannot confirm this. The bug can be reproduced with X.org 6.8.2 and X.org 6.9  
with the following test program:  
   
Simple test program test.c to reproduce this bug:     
---------------------------------------------     
     
#include <X11/Xlib.h>      
#include <X11/extensions/XInput.h>      
      
int main(int argc, char * argv[]) {      
        XInitThreads();      
        Display * dpy = XOpenDisplay(NULL);      
        XGetExtensionVersion (dpy, "XInputExtension");      
        return 0;      
}      
     
---------------------------------------------     
     
gcc -I/usr/include/X11 -L/usr/X11R6/lib -lXs11 -lXi -lpthread test.c -o test
Comment 2 Felix Hädicke 2005-12-26 11:33:47 UTC
*** Bug 5423 has been marked as a duplicate of this bug. ***
Comment 3 Felix Hädicke 2005-12-26 12:06:51 UTC
I found this in the XFree bug list: 
 
http://bugs.xfree86.org/show_bug.cgi?id=260 
 
They have a working bugfix. 
Comment 4 Felix Hädicke 2005-12-26 12:29:53 UTC
Created attachment 4163 [details] [review]
Port of XFree's patch (for X.org 6.9)

This patch works for me (hope there are no license issues due to license
differences between X.org and XFree86)
Comment 5 Daniel Stone 2007-02-27 01:29:32 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 6 Alan Coopersmith 2007-05-21 17:07:00 UTC
*** Bug 1413 has been marked as a duplicate of this bug. ***
Comment 7 Jeremy Huddleston Sequoia 2011-09-24 23:00:16 UTC
Current libXi uses _XiGetExtensionVersion which doesn't lock.  The reported thread fixes this in pretty much the same way as the current git, so I'm marking as fixed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.