Skip to content

Commit

Permalink
qom: call class destructor before unparent
Browse files Browse the repository at this point in the history
It seems more logical to have destruction flow start with the subclass
and move up to the base class.  This ensures object has a valid
canonical path when destructor is called.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
mstsirkin committed Mar 26, 2013
1 parent 0402a5d commit e998fa8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qom/object.c
Expand Up @@ -363,12 +363,12 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
void object_unparent(Object *obj)
{
object_ref(obj);
if (obj->parent) {
object_property_del_child(obj->parent, obj, NULL);
}
if (obj->class->unparent) {
(obj->class->unparent)(obj);
}
if (obj->parent) {
object_property_del_child(obj->parent, obj, NULL);
}
object_unref(obj);
}

Expand Down

0 comments on commit e998fa8

Please sign in to comment.