mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
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
This commit is contained in:
parent
0405786573
commit
f99cd18254
@ -114,11 +114,12 @@ test_destroy_destroy (ClutterActor *self)
|
|||||||
test->tex = NULL;
|
test->tex = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free_full (test->children, (GDestroyNotify) clutter_actor_destroy);
|
g_assert_nonnull (test->children);
|
||||||
test->children = NULL;
|
|
||||||
|
|
||||||
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
|
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
|
||||||
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
|
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
|
||||||
|
|
||||||
|
g_assert_null (test->children);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user