From: Paolo Bonzini Date: Tue, 2 Apr 2013 13:50:00 +0000 (+0200) Subject: qom: do nothing on unparent of object without parent X-Git-Tag: v1.5.0-rc0~245 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0a83fc2c1582dc8d4453849852ebe6c258b7c3a;p=thirdparty%2Fqemu.git 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: Paolo Bonzini Message-id: 1364910600-3418-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori --- diff --git a/qom/object.c b/qom/object.c index 881814943bb..093502e5099 100644 --- a/qom/object.c +++ b/qom/object.c @@ -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);