diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-09-17 09:42:27 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-09-17 09:42:27 -0400 |
commit | f46befec7c9c1561d2325df2325008a8a4e36328 (patch) | |
tree | 3b22d6f061e635a2fa1ef8189a4087097577fe69 | |
parent | 94d4b9249cd0702c26bd9d87dcfbea57569c6382 (diff) |
use wl_list_for_each_safe() to unlink client surfaces
-rw-r--r-- | types/wlr_xdg_shell_v6.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 827f3491..a7450add 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -632,14 +632,11 @@ static struct zxdg_shell_v6_interface xdg_shell_impl = { static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) { struct wlr_xdg_client_v6 *client = wl_resource_get_user_data(resource); - struct wl_list *list = &client->surfaces; - struct wl_list *link, *tmp; - - for (link = list->next, tmp = link->next; - link != list; - link = tmp, tmp = link->next) { - wl_list_remove(link); - wl_list_init(link); + + struct wlr_xdg_surface_v6 *surface, *tmp = NULL; + wl_list_for_each_safe(surface, tmp, &client->surfaces, link) { + wl_list_remove(&surface->link); + wl_list_init(&surface->link); } if (client->ping_timer != NULL) { |