mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
examples/foreign-toplevel: fix toplevel not being freed
This commit is contained in:
parent
c3e54021f8
commit
dc22a06184
1 changed files with 8 additions and 0 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue