[Xcb] leak in lissajoux

Jamey Sharp jamey at minilop.net
Fri Apr 28 11:16:52 PDT 2006

On Fri, Apr 28, 2006 at 07:00:45PM +0200, Vincent Torri wrote:
> When using lissaajoux with shm, there's a leak. It comes from xcb_image.c,
> line 477. I've written that code, so it's certainly wrong.

You give yourself too little credit. :-)

> The fact is that getting the reply seems necessary, otherwise nothing is
> drawn.
> So, what should I do ? returning the reply, so that the user can manage it
> ? If so, when must that reply be freed ?

Heh, I think I understand your confusion. ShmGetImage has a
wacky-looking reply: there isn't really any information in it.

But you have to wait for the reply to arrive before you can read out of
the shared memory segment. Until the reply arrives you have no guarantee
that the server has written your image to the segment.

So yes, you have to block on the reply, but you can immediately free it
when it arrives. You should probably return 0 if the reply is null,
though, as that indicates that some sort of error occurred.

Of course, using latency hiding would be nice here. So maybe the API
could stand a redesign -- but that applies to the whole XImage API
anyway. The API we have now is presently passable, particularly for
people porting preexisting projects.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060428/4f0e6b95/attachment.pgp

More information about the Xcb mailing list