[PATCH weston] xwm: Check whether the seat is NULL when needed in weston_wm_handle_button

Pekka Paalanen ppaalanen at gmail.com
Wed Sep 3 06:13:51 PDT 2014


On Wed,  3 Sep 2014 17:25:30 +0800
Boyan Ding <stu_dby at 126.com> wrote:

> XCB and wayland input event handling exists together in xwm, which can
> cause problems. weston_wm_handle_button is called via XCB events, while
> it calls weston_wm_pick_seat_for_window, which uses info from compositor
> (pure wayland). It is also true in setting and removing flags of frames.
> Races can happen in between, when resize of moving flag of the frame is
> still set while the button has been released, the picked seat will be
> NULL in weston_wm_handle_button, causing crash. We can safely ignore
> moving or resizing if this happens. The same applies to c06a180d.
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=82827
> Signed-off-by: Boyan Ding <stu_dby at 126.com>
> ---
>  xwayland/window-manager.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index a216b76..f633324 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -1648,12 +1648,14 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
>  		weston_wm_window_schedule_repaint(window);
>  
>  	if (frame_status(window->frame) & FRAME_STATUS_MOVE) {
> -		shell_interface->move(window->shsurf, seat);
> +		if (seat != NULL)
> +			shell_interface->move(window->shsurf, seat);
>  		frame_status_clear(window->frame, FRAME_STATUS_MOVE);
>  	}
>  
>  	if (frame_status(window->frame) & FRAME_STATUS_RESIZE) {
> -		shell_interface->resize(window->shsurf, seat, location);
> +		if (seat != NULL)
> +			shell_interface->resize(window->shsurf, seat, location);
>  		frame_status_clear(window->frame, FRAME_STATUS_RESIZE);
>  	}
>  

Excellent, pushed.


Thanks,
pq


More information about the wayland-devel mailing list