mirror of https://gitee.com/openkylin/qemu.git
qom: preserve object while unparenting it
Avoid that the object disappears after it's deleted from the QOM composition tree, in case that was the only reference to it. Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
4fec640446
commit
52e636cdd8
|
@ -361,12 +361,14 @@ 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);
|
||||
}
|
||||
object_unref(obj);
|
||||
}
|
||||
|
||||
static void object_deinit(Object *obj, TypeImpl *type)
|
||||
|
|
Loading…
Reference in New Issue