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>
This commit is contained in:
committed by
Pekka Paalanen
parent
e784e34228
commit
99bfa64799
+13
-1
@@ -920,7 +920,7 @@ x11_compositor_find_output(struct x11_compositor *c, xcb_window_t window)
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(0);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -929,6 +929,7 @@ x11_compositor_delete_window(struct x11_compositor *c, xcb_window_t window)
|
|||||||
struct x11_output *output;
|
struct x11_output *output;
|
||||||
|
|
||||||
output = x11_compositor_find_output(c, window);
|
output = x11_compositor_find_output(c, window);
|
||||||
|
if (output)
|
||||||
x11_output_destroy(&output->base);
|
x11_output_destroy(&output->base);
|
||||||
|
|
||||||
xcb_flush(c->conn);
|
xcb_flush(c->conn);
|
||||||
@@ -992,6 +993,8 @@ x11_compositor_deliver_button_event(struct x11_compositor *c,
|
|||||||
struct x11_output *output;
|
struct x11_output *output;
|
||||||
|
|
||||||
output = x11_compositor_find_output(c, button_event->event);
|
output = x11_compositor_find_output(c, button_event->event);
|
||||||
|
if (!output)
|
||||||
|
return;
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
xcb_grab_pointer(c->conn, 0, output->window,
|
xcb_grab_pointer(c->conn, 0, output->window,
|
||||||
@@ -1070,6 +1073,9 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
|
|||||||
if (!c->has_xkb)
|
if (!c->has_xkb)
|
||||||
update_xkb_state_from_core(c, motion_notify->state);
|
update_xkb_state_from_core(c, motion_notify->state);
|
||||||
output = x11_compositor_find_output(c, motion_notify->event);
|
output = x11_compositor_find_output(c, motion_notify->event);
|
||||||
|
if (!output)
|
||||||
|
return;
|
||||||
|
|
||||||
weston_output_transform_coordinate(&output->base,
|
weston_output_transform_coordinate(&output->base,
|
||||||
wl_fixed_from_int(motion_notify->event_x),
|
wl_fixed_from_int(motion_notify->event_x),
|
||||||
wl_fixed_from_int(motion_notify->event_y),
|
wl_fixed_from_int(motion_notify->event_y),
|
||||||
@@ -1096,6 +1102,9 @@ x11_compositor_deliver_enter_event(struct x11_compositor *c,
|
|||||||
if (!c->has_xkb)
|
if (!c->has_xkb)
|
||||||
update_xkb_state_from_core(c, enter_notify->state);
|
update_xkb_state_from_core(c, enter_notify->state);
|
||||||
output = x11_compositor_find_output(c, enter_notify->event);
|
output = x11_compositor_find_output(c, enter_notify->event);
|
||||||
|
if (!output)
|
||||||
|
return;
|
||||||
|
|
||||||
weston_output_transform_coordinate(&output->base,
|
weston_output_transform_coordinate(&output->base,
|
||||||
wl_fixed_from_int(enter_notify->event_x),
|
wl_fixed_from_int(enter_notify->event_x),
|
||||||
wl_fixed_from_int(enter_notify->event_y), &x, &y);
|
wl_fixed_from_int(enter_notify->event_y), &x, &y);
|
||||||
@@ -1245,6 +1254,9 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
case XCB_EXPOSE:
|
case XCB_EXPOSE:
|
||||||
expose = (xcb_expose_event_t *) event;
|
expose = (xcb_expose_event_t *) event;
|
||||||
output = x11_compositor_find_output(c, expose->window);
|
output = x11_compositor_find_output(c, expose->window);
|
||||||
|
if (!output)
|
||||||
|
break;
|
||||||
|
|
||||||
weston_output_damage(&output->base);
|
weston_output_damage(&output->base);
|
||||||
weston_output_schedule_repaint(&output->base);
|
weston_output_schedule_repaint(&output->base);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user