]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qom: do nothing on unparent of object without parent
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Apr 2013 13:50:00 +0000 (15:50 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Apr 2013 21:10:21 +0000 (16:10 -0500)
Otherwise, device_unparent will fail to get a canonical path of
the object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364910600-3418-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom/object.c

index 881814943bbd165d5dee301b967f93828a1d7e0b..093502e5099315ddcfd431ae94779cb896301461 100644 (file)
@@ -362,6 +362,10 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
 
 void object_unparent(Object *obj)
 {
+    if (!obj->parent) {
+        return;
+    }
+
     object_ref(obj);
     if (obj->class->unparent) {
         (obj->class->unparent)(obj);