From 667d22d1ae59da46b4c1fbd094ca61145f19b8c3 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 23 Nov 2012 09:47:13 +0100 Subject: qdev: move bus removal to object_unparent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an ObjectClass method that is done at object_unparent time. It should remove any backlinks to the object in the composition tree, so that object_delete will be able to drop the last reference and free the object. Use it for qdev buses. Reviewed-by: Andreas Färber Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- qom/object.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'qom') diff --git a/qom/object.c b/qom/object.c index 662ff7e093..07495066d5 100644 --- a/qom/object.c +++ b/qom/object.c @@ -363,6 +363,9 @@ void object_unparent(Object *obj) if (obj->parent) { object_property_del_child(obj->parent, obj, NULL); } + if (obj->class->unparent) { + (obj->class->unparent)(obj); + } } static void object_deinit(Object *obj, TypeImpl *type) -- cgit v1.2.3