diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-25 14:12:30 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-01 15:53:09 -0600 |
commit | 52e636cdd8528b8f72f43b653356ac177524912b (patch) | |
tree | 867e5147f3e8a1be685790bbe0209c496222cd82 /qom | |
parent | 4fec6404465fdb1f09670b1451605c7cbf87c01e (diff) | |
download | qemu-52e636cdd8528b8f72f43b653356ac177524912b.zip qemu-52e636cdd8528b8f72f43b653356ac177524912b.tar.gz qemu-52e636cdd8528b8f72f43b653356ac177524912b.tar.bz2 |
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 e200282..034f15c 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) |