From f99cd182545e8ac40e2a8653a57e68266cddf081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 15 May 2019 18:31:26 -0500 Subject: [PATCH] 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