summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-06-04 11:40:47 +0100
committerKristian Høgsberg <krh@bitplanet.net>2012-06-04 11:02:53 -0400
commite9e92d2ad79da20060c4815d5257e9d7fb887bcf (patch)
treee7768953065aac7c8944a978ccfa9f8ae25b7b79
parenta497d57619db0d1f82da938c74e856fe9780eecb (diff)
Fix sessions with no active input devices
Fix a few unconditional dereferences of seat->keyboard and seat->pointer in paths that could be hit outside of input event processing. Reported-by: Pekka Paalanen <ppaalanen@gmail.com> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--src/compositor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 797ab99..1383966 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -620,6 +620,9 @@ weston_device_repick(struct wl_seat *seat)
const struct wl_pointer_grab_interface *interface;
struct weston_surface *surface, *focus;
+ if (!seat->pointer)
+ return;
+
surface = weston_compositor_pick_surface(ws->compositor,
seat->pointer->x,
seat->pointer->y,
@@ -666,9 +669,11 @@ weston_surface_unmap(struct weston_surface *surface)
wl_list_remove(&surface->layer_link);
wl_list_for_each(seat, &surface->compositor->seat_list, link) {
- if (seat->seat.keyboard->focus == &surface->surface)
+ if (seat->seat.keyboard &&
+ seat->seat.keyboard->focus == &surface->surface)
wl_keyboard_set_focus(seat->seat.keyboard, NULL);
- if (seat->seat.pointer->focus == &surface->surface)
+ if (seat->seat.pointer &&
+ seat->seat.pointer->focus == &surface->surface)
wl_pointer_set_focus(seat->seat.pointer,
NULL,
wl_fixed_from_int(0),