qom: call class destructor before unparent
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>
This commit is contained in:
parent
0402a5d65e
commit
e998fa8df8
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user