diff options
author | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-24 15:19:26 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-06-25 10:33:58 +0200 |
commit | a7f48aab6968ad67ff7eef2828bd6f6e45c18ab5 (patch) | |
tree | ac1cc8c7bcec80f2b00387c33de7d6601f2fae5a | |
parent | 86e20f48c6643cdbf642baa2cd7ac371c2d187e8 (diff) | |
download | wlroots-a7f48aab6968ad67ff7eef2828bd6f6e45c18ab5.tar.xz |
xdg-decoration: free old configure structs
-rw-r--r-- | types/wlr_xdg_decoration_v1.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/types/wlr_xdg_decoration_v1.c b/types/wlr_xdg_decoration_v1.c index e8538097..544035b7 100644 --- a/types/wlr_xdg_decoration_v1.c +++ b/types/wlr_xdg_decoration_v1.c @@ -111,8 +111,9 @@ static void toplevel_decoration_handle_surface_ack_configure( wl_container_of(listener, decoration, surface_ack_configure); struct wlr_xdg_surface_configure *surface_configure = data; + // First find the ack'ed configure bool found = false; - struct wlr_xdg_toplevel_decoration_v1_configure *configure; + struct wlr_xdg_toplevel_decoration_v1_configure *configure, *tmp; wl_list_for_each(configure, &decoration->configure_list, link) { if (configure->surface_configure == surface_configure) { found = true; @@ -122,6 +123,14 @@ static void toplevel_decoration_handle_surface_ack_configure( if (!found) { return; } + // Then remove old configures from the list + wl_list_for_each_safe(configure, tmp, &decoration->configure_list, link) { + if (configure->surface_configure == surface_configure) { + break; + } + wl_list_remove(&configure->link); + free(configure); + } decoration->current_mode = configure->mode; |