[Xcb] problem with the use of the shm extension

Jamey Sharp jamey at minilop.net
Sat Oct 1 10:25:28 PDT 2005


On Sat, 2005-10-01 at 09:44 +0200, Vincent Torri wrote:
> I've seen that there's XCBShmInit in shm.h, but I don't know how to use
> it. Its call does not solve the problem. Should I do sommething with its
> reply ?
> 
> On Sat, 1 Oct 2005, Vincent Torri wrote:
> > I get this error message :
> >
> > ecore_evas_test: xcb_out.c:109: XCBSendRequest: Assertion `extension &&
> > extension->present' failed.

This error means that your X server doesn't have MIT-SHM. Have you
checked that with xdpyinfo?

The *Init calls are slated to go away since they're easy to implement by
calling other functions. You should include the equivalent code in the
initialization of your program, though:

const XCBQueryExtensionRep *r = XCBGetExtensionData(c, &XCBSHMId);

Then you can test both that r is not null (which would indicate some
sort of serious error) and that r->present is true. If r->present is
false, then the extension is not supported and you need to not use it
with that connection.

As the documentation for XCBGetExtensionData will tell you, don't free r
when you're done with it. This is the only XCB*Rep pointer that you're
not supposed to free. :-)

Note that XCBGetExtensionData caches its results, so you can call it
multiple times without a performance penalty. For best performance,
though, you should call XCBPrefetchExtensionData for all of the
extensions you want to use first, and then later call
XCBGetExtensionData as needed.

Your question points out a "bug" in XCB: having this error case result
in an assertion failure is kind of dumb. I've been trying to figure out
how to report this kind of error for a few years now, though, and
haven't got it yet. At the least I suppose it's a documentation bug.

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/xcb/attachments/20051001/939a4684/attachment.pgp


More information about the Xcb mailing list