From 2a9d4e73c5fce24fda93d1ff18610ec0cf1a8583 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 29 Nov 2016 11:08:46 -0500 Subject: [PATCH] correctly handle xdg surface deletion and pointer clearing fixes crashing/leaking when deleting surfaces --- src/modules/wl_desktop_shell/e_mod_main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index c818b9f04..5f10da94b 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -24,19 +24,15 @@ e_shell_surface_destroy(struct wl_resource *resource) ec->comp_data->grab = 0; } - shd = ec->comp_data->shell.data; + if (resource == ec->comp_data->shell.surface) + ec->comp_data->shell.surface = NULL; + shd = ec->comp_data->shell.data; if (shd) { E_FREE_LIST(shd->pending, free); - if ((resource == ec->comp_data->shell.surface) || (resource == shd->surface)) - { - if (ec->comp_data->shell.surface == resource) - ec->comp_data->shell.surface = NULL; - else - shd->surface = NULL; - E_FREE(ec->comp_data->shell.data); - } + if (resource == shd->surface) + E_FREE(ec->comp_data->shell.data); } if (ec->comp_data->mapped)