Skip to content

Commit

Permalink
clients/window: move code into global_destroy()
Browse files Browse the repository at this point in the history
Another patch will want to call global_destroy() too.

Pure refactoring, no functional change.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
  • Loading branch information
Pekka Paalanen committed May 31, 2021
1 parent d9b949d commit 1e08a81
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions clients/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 1e08a81

Please sign in to comment.