[PATCH weston v2] compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event
Sergi Granell
xerpi.g.12 at gmail.com
Wed Sep 27 14:06:37 UTC 2017
v2: Fix use after free spotted by Daniel Stone
Signed-off-by: Sergi Granell <xerpi.g.12 at gmail.com>
---
libweston/compositor-wayland.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index a99d4a5c..507262e3 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -1098,8 +1098,12 @@ static void
handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
{
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 = {
--
2.14.1
More information about the wayland-devel
mailing list