summaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c2
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)