xwm: check whether the picked seat can be NULL
authorBoyan Ding <stu_dby@126.com>
Sun, 6 Jul 2014 03:44:58 +0000 (11:44 +0800)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 19 Aug 2014 13:24:58 +0000 (16:24 +0300)
The seat picked in weston_wm_window_handle_moveresize can sometimes
be NULL when it is (somehow) triggered with all buttons released.

This patch checks whether the seat is NULL to avoid NULL dereference.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
Signed-off-by: Boyan Ding <stu_dby@126.com>
xwayland/window-manager.c

index 6cac278..f1523f5 100644 (file)
@@ -1244,8 +1244,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
        struct weston_shell_interface *shell_interface =
                &wm->server->compositor->shell_interface;
 
-       if (seat->pointer->button_count != 1 || !window->view
-           || seat->pointer->focus != window->view)
+       if (seat == NULL || seat->pointer->button_count != 1
+           || !window->view || seat->pointer->focus != window->view)
                return;
 
        detail = client_message->data.data32[2];