[Xcb] Invalid XIDs

Barton C Massey bart at cs.pdx.edu
Sun Jan 25 22:30:04 PST 2009

In message <961fa2b40901251643x5155f7bcpf2422b930eec8103 at mail.gmail.com> you wrote:
> > BTW, where did you find this information?  I can't see it
> > anywhere.  What Xlib does is weird, as one might predict.
> Xext/xcmisc.c and dix/resource.c in the xorg tree :-)

Sweet.  Thanks.

> (It's also unclear to me that there's anything anyone can do with an
> error return from xcb_generate_id -- does anyone even check?  Is it
> even guaranteed that (uint32_t)-1 indicates an error, rather than a
> valid XID?)

Well, we control the XCB spec, so I say "yes" on the
guarantee. :-)  Which means that we should check for that
case in the xcb_generate_id code.  Noted and fixed in my
branch.  I agree that folks normally probably don't bother
to look at the return anyhow, but they should have that

> > This code also brings up another issue.  While
> > ubiquitous, technically XC_MISC is an extension, so we
> > should be checking for its existence before trying to
> > use it, I think.
> I probably wouldn't bother until someone sent a bug report
> complaining about it, but that's just me :-).

It was easy to add. :-)

> > BTW, a really cool implementation would fall back to
> > XCMiscGetXIDList when XCMiscGetXIDRange failed, on the
> > grounds that one might be able to reuse some old XIDs that
> > way.  I haven't bothered, but maybe I should?
> Surely GetXIDList and GetXIDRange inform you about the same XIDs, just
> in different formats?

My guess was that GetXIDList would go back and scavenge XIDs
you'd freed, but I'd have to check the server to be sure.
GetXIDRange couldn't really sensibly do that, or if it did
you'd be calling it a *lot*...

Good luck with the bug hunt!  Thanks again for all your


More information about the Xcb mailing list