XGrabServer problem when opening a different display connection

pcpa at mandriva.com.br pcpa at mandriva.com.br
Sat May 10 07:56:32 PDT 2008


  This is kinda weird, but shows how to cause a "dead lock" after
issuing a XGrabServer/XUngrabServer.

  In the attached program, if using a smaller value to j (like 100)
it will work correctly, otherwise, when trying to open a new
Display connection, it will lock in the authorization code because
the server will not return any data.

  Warning: If you compile and run it, it will lock your X Server,
to restore, Ctrl+Alt+F1, log in, and "$ kill `pidof a.out`"

  This was a problem in krandrtray, that was modified to do exactly
what xrandr does, i.e. it uses XGrabServer/XUngrabServer to avoid
problems with clients, like kdesktop getting the wrong resolution
in some cases. Again, usually "event buffering problems", and
sometimes kdesktop receiving "outdated" randr notifications.

  The problem wasn't exactly krandr, but a module that got in the
way, and the problem was fixed by changing the module to use
qt_xdisplay() instead of opening it's own display connection.

  But still, maybe this could be handled in libX11 or libxcb.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: xgrab-test.c
Type: text/x-csrc
Size: 535 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080510/f19d7c70/attachment.c>

More information about the xorg mailing list