[mutter] clutter/tests/actor-destroy: Check destroying the actor clears the children



commit f99cd182545e8ac40e2a8653a57e68266cddf081
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed May 15 18:31:26 2019 -0500

    clutter/tests/actor-destroy: Check destroying the actor clears the children
    
    Commit df7d8e2cb highlights a crash on test_destroy_destroy, in fact it could
    happen that calling clutter_actor_destroy on a child while iterating on the
    list, would implicitly call test_destroy_remove that tries to modify the list
    at the same time. Causing a memory error.
    
    So instead of manually free the children list, just ensure that this list is
    valid and that when the object destruction is done, this is free'd.
    
    See: https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/581

 clutter/tests/conform/actor-destroy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/clutter/tests/conform/actor-destroy.c b/clutter/tests/conform/actor-destroy.c
index 4677c9537..10ad79df7 100644
--- a/clutter/tests/conform/actor-destroy.c
+++ b/clutter/tests/conform/actor-destroy.c
@@ -114,11 +114,12 @@ test_destroy_destroy (ClutterActor *self)
       test->tex = NULL;
     }
 
-  g_list_free_full (test->children, (GDestroyNotify) clutter_actor_destroy);
-  test->children = NULL;
+  g_assert_nonnull (test->children);
 
   if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
     CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
+
+  g_assert_null (test->children);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]