Skip to content

Commit

Permalink
clients/window: destroy remaining globals
Browse files Browse the repository at this point in the history
Destroy the remaining globals on exit. Fixes a bunch of leaks reported
by ASan.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
  • Loading branch information
Pekka Paalanen committed May 31, 2021
1 parent 1e08a81 commit c8c53ba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions clients/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -6083,8 +6083,6 @@ registry_handle_global_remove(void *data, struct wl_registry *registry,
if (strcmp(global->interface, "wl_output") == 0)
display_destroy_output(d, name);

/* XXX: Should destroy remaining bound globals */

global_destroy(d, global);
}
}
Expand Down Expand Up @@ -6328,6 +6326,8 @@ display_destroy_inputs(struct display *display)
void
display_destroy(struct display *display)
{
struct global *global, *tmp;

if (!wl_list_empty(&display->window_list))
fprintf(stderr, "toytoolkit warning: %d windows exist.\n",
wl_list_length(&display->window_list));
Expand All @@ -6343,6 +6343,9 @@ display_destroy(struct display *display)
display_destroy_outputs(display);
display_destroy_inputs(display);

wl_list_for_each_safe(global, tmp, &display->global_list, link)
global_destroy(display, global);

xkb_context_unref(display->xkb_context);

if (display->theme)
Expand All @@ -6354,6 +6357,15 @@ display_destroy(struct display *display)
fini_egl(display);
#endif

if (display->relative_pointer_manager)
zwp_relative_pointer_manager_v1_destroy(display->relative_pointer_manager);

if (display->pointer_constraints)
zwp_pointer_constraints_v1_destroy(display->pointer_constraints);

if (display->viewporter)
wp_viewporter_destroy(display->viewporter);

if (display->subcompositor)
wl_subcompositor_destroy(display->subcompositor);

Expand Down

0 comments on commit c8c53ba

Please sign in to comment.