compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event

v2: Fix use after free spotted by Daniel Stone

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Sergi Granell 7 years ago committed by Pekka Paalanen
parent cafc652cf6
commit b4e239f29f
  1. 6
      libweston/compositor-wayland.c

@ -1098,8 +1098,12 @@ static void
handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
{ {
struct wayland_output *output = data; struct wayland_output *output = data;
struct weston_compositor *compositor = output->base.compositor;
weston_compositor_exit(output->base.compositor); wayland_output_destroy(&output->base);
if (wl_list_empty(&compositor->output_list))
weston_compositor_exit(compositor);
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {

Loading…
Cancel
Save