After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735388 - xi2 device manager gets a "0" client pointer if queried very early in app lifetime
xi2 device manager gets a "0" client pointer if queried very early in app lif...
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: x11
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-25 14:30 UTC by Carlos Garnacho
Modified: 2014-08-25 15:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xi2: XSync before getting the client pointer on construction (1.30 KB, patch)
2014-08-25 14:30 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2014-08-25 14:30:06 UTC
(Note: Still wondering if this is actually an xserver bug)

Normally the device manager is created implicitly after some messaging with the server, so the XIGetClientPointer() call done on xi2 device manager construction successfully returns the client pointer (most normally the VCP).

However, if the device manager is created very early during app lifetime, and queried for the client pointer, the call happens at a time when the server still hasn't allocated a client pointer for this client, so 0 is returned as the client pointer (which is actually not a device id), as a result that first attempt to get the client pointer returns NULL. This is visible with current mutter --wayland master, the client pointer is queried/stored early, and several misbehaviors/warnings can be seen in result.

I'm attaching a patch that does XSync before that attempt to get the client pointer, so it is ensured to be non-NULL on all situations.
Comment 1 Carlos Garnacho 2014-08-25 14:30:54 UTC
Created attachment 284406 [details] [review]
xi2: XSync before getting the client pointer on construction

If the device manager is created and queried for the client pointer at
a very early stage in application lifetime, the device_id returned would
be 0 as the server hasn't apparently decided yet about the client pointer.

For these situations, doing XSync prior to fetching the client pointer
gets the server to device about the client pointer before we query it.
Comment 2 Emmanuele Bassi (:ebassi) 2014-08-25 14:45:40 UTC
Review of attachment 284406 [details] [review]:

sounds reasonable.
Comment 3 Carlos Garnacho 2014-08-25 15:08:44 UTC
Attachment 284406 [details] pushed as 591d31c - xi2: XSync before getting the client pointer on construction