diff options
| author | Paolo Bonzini | 2013-04-02 15:50:00 +0200 |
|---|---|---|
| committer | Anthony Liguori | 2013-04-16 23:10:21 +0200 |
| commit | e0a83fc2c1582dc8d4453849852ebe6c258b7c3a (patch) | |
| tree | be26639b0818c8f8c01b489c40e80510f00d4f39 | |
| parent | qdev: Fix device_add bus assumptions (diff) | |
| download | qemu-e0a83fc2c1582dc8d4453849852ebe6c258b7c3a.tar.gz qemu-e0a83fc2c1582dc8d4453849852ebe6c258b7c3a.tar.xz qemu-e0a83fc2c1582dc8d4453849852ebe6c258b7c3a.zip | |
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>
| -rw-r--r-- | qom/object.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index 881814943b..093502e509 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); |
