diff options
| author | Paolo Bonzini | 2013-01-25 14:12:30 +0100 |
|---|---|---|
| committer | Anthony Liguori | 2013-02-01 22:53:09 +0100 |
| commit | 52e636cdd8528b8f72f43b653356ac177524912b (patch) | |
| tree | 867e5147f3e8a1be685790bbe0209c496222cd82 /qom | |
| parent | pci: use qbus_create in pci_bus_new (diff) | |
| download | qemu-52e636cdd8528b8f72f43b653356ac177524912b.tar.gz qemu-52e636cdd8528b8f72f43b653356ac177524912b.tar.xz qemu-52e636cdd8528b8f72f43b653356ac177524912b.zip | |
qom: preserve object while unparenting it
Avoid that the object disappears after it's deleted from the QOM
composition tree, in case that was the only reference to it.
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qom')
| -rw-r--r-- | qom/object.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index e200282172..034f15cdec 100644 --- a/qom/object.c +++ b/qom/object.c @@ -361,12 +361,14 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) void object_unparent(Object *obj) { + object_ref(obj); if (obj->parent) { object_property_del_child(obj->parent, obj, NULL); } if (obj->class->unparent) { (obj->class->unparent)(obj); } + object_unref(obj); } static void object_deinit(Object *obj, TypeImpl *type) |
