xcb_disconnect: call shutdown() to force a disconnect
authorAaron Plattner <aplattner@nvidia.com>
Tue, 17 Aug 2010 15:04:41 +0000 (08:04 -0700)
committerPeter Harris <pharris@opentext.com>
Thu, 26 Aug 2010 01:40:52 +0000 (21:40 -0400)
commit7f5cfcc2fd0168d505504cc088bfdcba5c71f0ea
treec4ad3aae5efd7c86593a3fed729c6644679f8e02
parent2040f10a4efa95092bc9409c5b20347989b5f0a2
xcb_disconnect: call shutdown() to force a disconnect

Fixes the X Test Suite's XCloseDisplay-6 test, which has this (admittedly
ridiculous) behavior:

 1. Create a window w.
 2. Open two display connections, dpy1, and dpy2.
 3. Grab the server using dpy1.
 4. Fork.
 5 (child). XSetProperty on w using dpy2.
 5 (parent). Verify that no event was recieved on dpy1.
 6 (parent). XCloseDisplay(dpy1).
 6 (child). Verify that an event was received on dpy2.

It was failing because at step 6 (child), the server had not actually ungrabbed
yet because the file descriptor for dpy1 was still open in the child process.

Shutting down the socket during XCloseDisplay matches the behavior of non-XCB
Xlib, which calls shutdown() from _X11TransSocketDisconnect.

Thanks to Julien Cristau for noticing this.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
src/xcb_conn.c