[Xcb] [Patch] Fix some api docs (was: Hangs with xcb_take_socket)

Uli Schlachter psychon at znc.in
Wed Nov 17 11:34:45 PST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Am 17.11.2010 19:47, Jamey Sharp wrote:
>> let's consider the following events:
>>
>> I use xcb_take_socket(), current sequence number is 0xffff.
>> I send 2*2^16 XRENDER requests, all of which don't cause any reply. This causes
>> two sequence number wraps and the current sequence number is now 0x2fffff, but
>> the X server will only report 0xffff in replies/events, so if xcb sees the next
>> reply, it will expand it's sequence number to e.g. 0x1ffff when it really should
>> have been 0x2ffff.
>> I hope this makes the problem clear.
> 
> Yes, it does. XCB is normally careful to insert GetInputFocus requests
> exactly when they're needed, but it can't insert requests when callers
> use xcb_take_socket.
> 
> Here's the rule: Keep track of the sequence number of the last
> response you received. If
> request >= last_response + (1 << 16) - 2
> then you need to issue a sync first.
[...]

I figured this part out and wrote a patch for cairo which makes it do this[1],
but I don't think this is really nice. The whole xcb_take_socket() stuff isn't
nice, but this is even less nice. ;)

[1]
http://git.znc.in/?p=psychon/cairo.git;a=commitdiff;h=303fa7bc625579208316000b82c0e51414b3965e

> And of course you don't have to do any of this if you don't use
> xcb_take_socket, which I would recommend. :-)

Sounds good. For the other brave souls who wander down that road, attached is a
patch which fixes/improves the docs for xcb_take_socket() and xcb_writev().
Hopefully the next one to find this issue won't have to read xcb's source code.

Could someone commit that patch?

Cheers,
Uli

- -- 
- - Buck, when, exactly, did you lose your mind?
- - Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJM5C5SAAoJECLkKOvLj8sGHDIH/2IYbZ83UpfLdqo0jmcAE/Cc
AXuX40njruV7nvLWonFVj/gOMxGJI8KUnO1ZcDA7UPbDk4KeFVKy0H24SyGeK4oG
WnQOUu3gNszp03GQSj9HJeXaL2GhrBvtn5dlWhnU8hPXKrUpreLiJX8wpOO4Tzuf
O337letWVq99OvbW68Fczou3c1XalEsyvzOAypbgfIeVa36O++h4mkoOyqR8D9oe
PlQdSelKD+/F0J3yddM7reE1RJN1cB998EpkLTgoOuplZ8mbq6cVdl3wIrqFHUW5
+5HNRKGS0+PP54g1xXlZ+az4Q64wOQERZ4VHFHmkswP5w3pZgxGfbZ8N0tfpBzs=
=ZVU1
-----END PGP SIGNATURE-----


More information about the Xcb mailing list