From e998fa8df828ef68ea540a12917d10b4d335c1dd Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Mon, 18 Mar 2013 21:01:37 +0200 Subject: [PATCH] qom: call class destructor before unparent It seems more logical to have destruction flow start with the subclass and move up to the base class. This ensures object has a valid canonical path when destructor is called. Signed-off-by: Michael S. Tsirkin --- qom/object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index 3d638ff273e8..a0e3cbe5596c 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); }