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