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 <pbonzini@redhat.com> Message-id: 1364910600-3418-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
2f7bd829db
commit
e0a83fc2c1
@ -362,6 +362,10 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
|
|||||||
|
|
||||||
void object_unparent(Object *obj)
|
void object_unparent(Object *obj)
|
||||||
{
|
{
|
||||||
|
if (!obj->parent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
object_ref(obj);
|
object_ref(obj);
|
||||||
if (obj->class->unparent) {
|
if (obj->class->unparent) {
|
||||||
(obj->class->unparent)(obj);
|
(obj->class->unparent)(obj);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user