From dc22a0618445bea41308422b3cb050eb19dc9fd6 Mon Sep 17 00:00:00 2001 From: fwsmit Date: Wed, 6 Oct 2021 23:07:02 +0200 Subject: examples/foreign-toplevel: fix toplevel not being freed --- examples/foreign-toplevel.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'examples') diff --git a/examples/foreign-toplevel.c b/examples/foreign-toplevel.c index 820fc07b..2d16f77b 100644 --- a/examples/foreign-toplevel.c +++ b/examples/foreign-toplevel.c @@ -128,6 +128,11 @@ static void print_toplevel_state(struct toplevel_v1 *toplevel, bool print_endl) } } +static void finish_toplevel_state(struct toplevel_state *state) { + free(state->title); + free(state->app_id); +} + static void toplevel_handle_title(void *data, struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, const char *title) { @@ -228,6 +233,9 @@ static void toplevel_handle_closed(void *data, printf(" closed\n"); zwlr_foreign_toplevel_handle_v1_destroy(zwlr_toplevel); + finish_toplevel_state(&toplevel->current); + finish_toplevel_state(&toplevel->pending); + free(toplevel); } static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = { -- cgit v1.2.3