Comment 98 for bug 507062

Bryce Harrington (bryce) wrote :

Fwiw, the code in question where the assert is being hit is:

static const XID inval_id = ~0UL;

/* _XAllocID - resource ID allocation routine. */
XID _XAllocID(Display *dpy)
        XID ret = dpy->xcb->next_xid;
        assert (ret != inval_id);
        dpy->xcb->next_xid = inval_id;
        return ret;

So it looks like cairo is calling into X holding an invalid X id, and this trips the assert. libx11 is certainly catching the error, but might not be the root cause of the problem. The question is why does dpy->xcb hold an invalid next_xid - backtraces aren't going to help answer that, I think it'll need some deeper examination of the execution flow either in gdb or with printf's sprinkled in strategic places.

Alternatively, looking at cairo-1.8.8/src/cairo-xlib-surface.c:155 might turn up something as to why the Display object has invalid xids in it.