From 1e08a81c432c32f3f87061cd867e346a439f8545 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 21 May 2021 17:29:42 +0300 Subject: [PATCH] clients/window: move code into global_destroy() Another patch will want to call global_destroy() too. Pure refactoring, no functional change. Signed-off-by: Pekka Paalanen --- clients/window.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/clients/window.c b/clients/window.c index a0f4dc68..ecb12e0b 100644 --- a/clients/window.c +++ b/clients/window.c @@ -5997,6 +5997,19 @@ static const struct xdg_wm_base_listener wm_base_listener = { xdg_wm_base_ping, }; +static void +global_destroy(struct display *disp, struct global *g) +{ + if (disp->global_handler_remove) { + disp->global_handler_remove(disp, g->name, g->interface, + g->version, disp->user_data); + } + + wl_list_remove(&g->link); + free(g->interface); + free(g); +} + static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -6072,13 +6085,7 @@ registry_handle_global_remove(void *data, struct wl_registry *registry, /* XXX: Should destroy remaining bound globals */ - if (d->global_handler_remove) - d->global_handler_remove(d, name, global->interface, - global->version, d->user_data); - - wl_list_remove(&global->link); - free(global->interface); - free(global); + global_destroy(d, global); } }