[Xcb] [PATCH 2/7] Ensure that there's still a valid connection to the X server before attempting to send a request.

Julien Danjou julien at danjou.info
Thu Mar 8 07:19:20 PST 2012


On Wed, Feb 29 2012, Alex Plotnick wrote:

> ---
>  src/ext.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> 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;

Hm, "return NULL" seems horrible. Why about raising an exception?

-- 
           Julien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20120308/71f0762a/attachment.pgp>


More information about the Xcb mailing list