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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2021-05-21 17:29:42 +03:00
parent d9b949d8b9
commit 1e08a81c43
1 changed files with 14 additions and 7 deletions

View File

@ -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);
}
}