[PATCH] xwayland: Allow dump_property when selection fails

Bryce Harrington bryce at osg.samsung.com
Fri Jul 10 18:50:48 PDT 2015


On Fri, Jul 10, 2015 at 06:16:11PM -0700, Bryce Harrington wrote:
> dump_property allows reply to be NULL.  Calling it unconditionally will
> ensure user knows where the selection failed.
> 
> Also refactor code a bit.
> 
> Suggested by Marek Chalupa
> 
> Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>

I accidentally pushed this one when I pushed Derek's patch.  This is a
simple refactor and I'm confident it's safe to go in, but if anyone has
qualms let me know and I will revert.

> ---
>  xwayland/selection.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/xwayland/selection.c b/xwayland/selection.c
> index 2f60c0e..452cd69 100644
> --- a/xwayland/selection.c
> +++ b/xwayland/selection.c
> @@ -240,14 +240,14 @@ weston_wm_get_selection_data(struct weston_wm *wm)
>  				  0x1fffffff /* length */);
>  
>  	reply = xcb_get_property_reply(wm->conn, cookie, NULL);
> -	if (reply == NULL)
> -		return;
>  
> -	if (reply->type == wm->atom.incr) {
> -		dump_property(wm, wm->atom.wl_selection, reply);
> +	dump_property(wm, wm->atom.wl_selection, reply);
> +
> +	if (reply == NULL) {
> +		return;
> +	} else if (reply->type == wm->atom.incr) {
>  		wm->incr = 1;
>  	} else {
> -		dump_property(wm, wm->atom.wl_selection, reply);
>  		wm->incr = 0;
>  		weston_wm_write_property(wm, reply);
>  	}
> -- 
> 1.9.1


More information about the wayland-devel mailing list