<div dir="ltr">But all the other existing code that uses _XiCheckExtInit expects it to unlock on error, but not on success. Peter wrote this code, though, so I'll let him have the final say.<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Jul 9, 2014 at 6:31 AM, walter harms <span dir="ltr"><<a href="mailto:wharms@bfs.de" target="_blank">wharms@bfs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Am 09.07.2014 12:23, schrieb Jasper St. Pierre:<br>
<div class="">> _XiCheckExtInit already unlocks the display on error. Yes, it's terrible.<br>
><br>
><br>
<br>
</div>In this case,<br>
it would be better to move the lock/unlock into _XiCheckExtInit.<br>
<br>
re,<br>
 wh<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
> On Wed, Jul 9, 2014 at 3:23 AM, walter harms <<a href="mailto:wharms@bfs.de">wharms@bfs.de</a>> wrote:<br>
><br>
>><br>
>><br>
>> Am 08.07.2014 23:01, schrieb Jasper St. Pierre:<br>
>>> _XIPassiveGrabDevice calls LockDisplay as the first thing it does. That<br>
>>> means that it expects the display to be unlocked. XIGrabTouchBegin locks<br>
>>> the display to check for the XI extension, and then never unlocks it.<br>
>>> Effectively, this meant that anybody that called XIGrabTouchBegin after<br>
>>> XInitThreads just got a deadlock.<br>
>>><br>
>>> Cool.<br>
>>> ---<br>
>>>  src/XIPassiveGrab.c | 1 +<br>
>>>  1 file changed, 1 insertion(+)<br>
>>><br>
>>> diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c<br>
>>> index f3a9924..88f1aff 100644<br>
>>> --- a/src/XIPassiveGrab.c<br>
>>> +++ b/src/XIPassiveGrab.c<br>
>>> @@ -166,6 +166,7 @@ XIGrabTouchBegin(Display *dpy, int deviceid, Window<br>
>> grab_window,<br>
>>>      LockDisplay(dpy);<br>
>>>      if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1)<br>
>>>       return -1;<br>
>>> +    UnlockDisplay(dpy);<br>
>>><br>
>>>      /* FIXME: allow selection of GrabMode for paired devices? */<br>
>>>      return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeTouchBegin, 0,<br>
>><br>
>><br>
>> I am not an expert on this but you should  unlock the display on error<br>
>> also.<br>
>> I would do it this way:<br>
>><br>
>> LockDisplay(dpy);<br>
>> err=_XiCheckExtInit(dpy, XInput_2_2, extinfo);<br>
>> UnlockDisplay(dpy);<br>
>> if (err == -1)<br>
>>         return -1;<br>
>><br>
>> jz'ust my 2 cents<br>
>> re,<br>
>>  wh<br>
>><br>
>> _______________________________________________<br>
>> <a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
>> Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
>> Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
>><br>
><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div>