summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qom/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c
index 3d638ff273..a0e3cbe559 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -363,12 +363,12 @@ 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);
}
+ if (obj->parent) {
+ object_property_del_child(obj->parent, obj, NULL);
+ }
object_unref(obj);
}