[PATCH 2/3] xwm: Check result of xcb_get_atom_name_reply

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 14 11:41:04 PDT 2013


On Tue, Jun 11, 2013 at 07:59:42PM -0500, MoD wrote:
> When printing debug information about atoms, the XWM would crash if the X
> server failed to respond to a request about atom names. In practice this
> occurred when the server itself crashed, e.g. when starting mplayer with the
> "xv" vo.

Looks good, applied.

Kristian

> ---
>  src/xwayland/window-manager.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index a021c76..d4be4ca 100644
> --- a/src/xwayland/window-manager.c
> +++ b/src/xwayland/window-manager.c
> @@ -137,9 +137,15 @@ get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
>  
>  	cookie = xcb_get_atom_name (c, atom);
>  	reply = xcb_get_atom_name_reply (c, cookie, &e);
> -	snprintf(buffer, sizeof buffer, "%.*s",
> -		 xcb_get_atom_name_name_length (reply),
> -		 xcb_get_atom_name_name (reply));
> +
> +	if(reply) {
> +		snprintf(buffer, sizeof buffer, "%.*s",
> +			 xcb_get_atom_name_name_length (reply),
> +			 xcb_get_atom_name_name (reply));
> +	} else {
> +		snprintf(buffer, sizeof buffer, "(atom %u)", atom);
> +	}
> +
>  	free(reply);
>  
>  	return buffer;
> -- 
> 1.8.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list