It makes more sense to call the post_init() hook of the parent first
then the child, just like what we do in the rest of the hooks.

CC: Andreas Färber <afaer...@suse.de>
CC: Markus Armbruster <arm...@redhat.com>
CC: Eduardo Habkost <ehabk...@redhat.com>
Signed-off-by: Peter Xu <pet...@redhat.com>
---
 qom/object.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index dfdbd50..e2c9c4a 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -347,13 +347,13 @@ static void object_init_with_type(Object *obj, TypeImpl 
*ti)
 
 static void object_post_init_with_type(Object *obj, TypeImpl *ti)
 {
-    if (ti->instance_post_init) {
-        ti->instance_post_init(obj);
-    }
-
     if (type_has_parent(ti)) {
         object_post_init_with_type(obj, type_get_parent(ti));
     }
+
+    if (ti->instance_post_init) {
+        ti->instance_post_init(obj);
+    }
 }
 
 static void object_initialize_with_type(void *data, size_t size, TypeImpl 
*type)
-- 
2.7.4


Reply via email to