[Xcb] [PATCH 2/7] Ensure that there's still a valid connection to the X server before attempting to send a request.
Alex Plotnick
shrike at netaxs.com
Wed Feb 29 12:28:06 PST 2012
At or around Wed, 29 Feb 2012 20:42:04 +0100, Uli Schlachter said:
> On 29.02.2012 17:59, Alex Plotnick wrote:
> > diff --git a/src/ext.c b/src/ext.c
> > index 2d622d9..6475850 100644
> > --- a/src/ext.c
> > +++ b/src/ext.c
> > @@ -113,6 +113,10 @@ xpybExt_send_request(xpybExt *self, PyObject *args, PyObject *kw)
> > return NULL;
> > }
> >
> > + /* Check the connection */
> > + if (xpybConn_invalid(self->conn))
> > + return NULL;
> > +
> > /* Set up request structure */
> > xcb_req.count = 2;
> > xcb_req.ext = (self->key != (xpybExtkey *)Py_None) ? &self->key->key : 0;
>
> I don't know much about xpyb's internals, but what exactly is the problem that
> this patch fixes? Looking at the code, I'd expect the code to not do anything
> bad with an error connection.
A few lines down, there's a call to xcb_send_request(self->conn->conn, ...).
When that first argument is NULL, it dumps core. I consider that bad.
This isn't a hypothetical problem; I fixed this because it was actually
crashing there. There's similar guard code in some of the other functions,
but it was missing here.
> IMHO some of the other patches could need a more verbose commit message, too.
I didn't really feel like the trivial ones needed much detail, but if
others disagree, I'd be happy to provide it. Which ones in particular
did you have in mind?
> Now let's figure out who the resident xpyb expert is and wake him up. :-)
I'm certainly not an xpyb (or xcb) expert; I'm just an interested user
that ran into some problems, and did the best I could to fix them. I'd
appreciate feedback from someone that knows the internals better than
I do.
Thanks,
-- Alex
More information about the Xcb
mailing list