summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2017-02-28 14:27:52 +0100
committerAdam Jackson <ajax@redhat.com>2017-03-02 14:54:12 -0500
commitc84f5c3dd19ae114da4eb3441b3e4e3a29f195df (patch)
treee38a856624769edfa32d9eb6d4224b356372631d
parent94c3454d9fdbcefb01042c5c9d88468d86dd4725 (diff)
xwayland: Make sure we have a focus window
During the InitInput() phase, the wayland events get dequeued so we can possibly end up calling dispatch_pointer_motion_event(). If this occurs before xwl_seat->focus_window is set, it leads to a NULL pointer derefence and a segfault. Check for xwl_seat->focus_window in both pointer_handle_frame() and relative_pointer_handle_relative_motion() prior to calling dispatch_pointer_motion_event() like it's done in pointer_handle_motion(). Bugzilla: https://bugzilla.redhat.com/1410804 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 8c9909a99292b2fb4a86de694bb0029f61e35662)
-rw-r--r--hw/xwayland/xwayland-input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index ecf0b7a62..ce0e433b8 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -516,6 +516,9 @@ pointer_handle_frame(void *data, struct wl_pointer *wl_pointer)
{
struct xwl_seat *xwl_seat = data;
+ if (!xwl_seat->focus_window)
+ return;
+
dispatch_pointer_motion_event(xwl_seat);
}
@@ -566,6 +569,9 @@ relative_pointer_handle_relative_motion(void *data,
xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf);
xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf);
+ if (!xwl_seat->focus_window)
+ return;
+
if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5)
dispatch_pointer_motion_event(xwl_seat);
}