desktop-shell: initialize children link
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 28 Jan 2014 12:54:16 +0000 (13:54 +0100)
committerKristian Høgsberg <krh@bitplanet.net>
Sat, 1 Feb 2014 09:29:13 +0000 (01:29 -0800)
Since commit 9046d2, when destroying a surface, we remove all the
links from its children. But when the child surfaces are destroyed,
those links will be removed again, but since they were not properly
initialized, weston will crash.

Call shell_surface_set_parent instead which removes the link and
sets parent while also initializing the link, thus avoiding this
crash.

desktop-shell/shell.c

index 756bbdc..7d85a7b 100644 (file)
@@ -2927,10 +2927,8 @@ destroy_shell_surface(struct shell_surface *shsurf)
        weston_view_destroy(shsurf->view);
 
        wl_list_remove(&shsurf->children_link);
-       wl_list_for_each_safe(child, next, &shsurf->children_list, children_link) {
-               wl_list_remove(&child->children_link);
-               child->parent = NULL;
-       }
+       wl_list_for_each_safe(child, next, &shsurf->children_list, children_link)
+               shell_surface_set_parent(child, NULL);
 
        wl_list_remove(&shsurf->link);
        free(shsurf);