Commit e0a83fc2 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Anthony Liguori
Browse files

qom: do nothing on unparent of object without parent



Otherwise, device_unparent will fail to get a canonical path of
the object.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1364910600-3418-1-git-send-email-pbonzini@redhat.com
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 2f7bd829
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);