summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2014-12-11 15:44:46 -0600
committerBryce Harrington <bryce@osg.samsung.com>2015-01-16 09:37:39 -0800
commit99bf5e4d87c877165ce6c3732b93e91f45e62b34 (patch)
treebd66d11d1a9e7681e603b3a243de415f462f6654
parent25542e22ff3349c63c77de9e74defc25df7882ac (diff)
compositor-x11: Fix some shutdown crashes
The assertion in x11_compositor_find_output() can trigger during normal shutdown, for example, when moving the mouse while hitting a hotkey to close the weston window. Instead we can remove the assert(), return NULL, and discard events we can't find a destination output for. v2 Signed-off-by: Derek Foreman <derekf@osg.samsung.com> v1 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--src/compositor-x11.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index b602bc9a..a4262be8 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -922,7 +922,7 @@ x11_compositor_find_output(struct x11_compositor *c, xcb_window_t window)
return output;
}
- assert(0);
+ return NULL;
}
static void
@@ -931,7 +931,8 @@ x11_compositor_delete_window(struct x11_compositor *c, xcb_window_t window)
struct x11_output *output;
output = x11_compositor_find_output(c, window);
- x11_output_destroy(&output->base);
+ if (output)
+ x11_output_destroy(&output->base);
xcb_flush(c->conn);
@@ -994,6 +995,8 @@ x11_compositor_deliver_button_event(struct x11_compositor *c,
struct x11_output *output;
output = x11_compositor_find_output(c, button_event->event);
+ if (!output)
+ return;
if (state)
xcb_grab_pointer(c->conn, 0, output->window,
@@ -1072,6 +1075,9 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
if (!c->has_xkb)
update_xkb_state_from_core(c, motion_notify->state);
output = x11_compositor_find_output(c, motion_notify->event);
+ if (!output)
+ return;
+
weston_output_transform_coordinate(&output->base,
wl_fixed_from_int(motion_notify->event_x),
wl_fixed_from_int(motion_notify->event_y),
@@ -1098,6 +1104,9 @@ x11_compositor_deliver_enter_event(struct x11_compositor *c,
if (!c->has_xkb)
update_xkb_state_from_core(c, enter_notify->state);
output = x11_compositor_find_output(c, enter_notify->event);
+ if (!output)
+ return;
+
weston_output_transform_coordinate(&output->base,
wl_fixed_from_int(enter_notify->event_x),
wl_fixed_from_int(enter_notify->event_y), &x, &y);
@@ -1247,6 +1256,9 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
case XCB_EXPOSE:
expose = (xcb_expose_event_t *) event;
output = x11_compositor_find_output(c, expose->window);
+ if (!output)
+ break;
+
weston_output_damage(&output->base);
weston_output_schedule_repaint(&output->base);
break;