[PATCH weston] xwm: do not crash when activating a NULL surface

Bill Spitzak spitzak at gmail.com
Sat Aug 10 15:37:11 PDT 2013


On 08/10/2013 08:23 AM, Giulio Camuffo wrote:
> ---
>   src/xwayland/window-manager.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index d565888..b710560 100644
> --- a/src/xwayland/window-manager.c
> +++ b/src/xwayland/window-manager.c
> @@ -610,11 +610,15 @@ static void
>   weston_wm_window_activate(struct wl_listener *listener, void *data)
>   {
>   	struct weston_surface *surface = data;
> -	struct weston_wm_window *window = get_wm_window(surface);

I think it would be better to put this here:

         struct weston_wm_window *window = surface ? 
get_wm_window(surface) : NULL

> +	struct weston_wm_window *window = NULL;
>   	struct weston_wm *wm =
>   		container_of(listener, struct weston_wm, activate_listener);
>   	xcb_client_message_event_t client_message;

Rather than this other one lower down:

> +	if (data) {
> +		window = get_wm_window(surface);
> +	}

Even in this version I would use if(surface), not if(data)




More information about the wayland-devel mailing list