diff options
author | Paolo Bonzini | 2012-11-23 09:47:13 +0100 |
---|---|---|
committer | Anthony Liguori | 2012-11-26 20:41:00 +0100 |
commit | 667d22d1ae59da46b4c1fbd094ca61145f19b8c3 (patch) | |
tree | db6acb0b6dce798eb5588ef8d05a9873e8114ddc /include | |
parent | qom: fix refcount of non-heap-allocated objects (diff) | |
download | qemu-667d22d1ae59da46b4c1fbd094ca61145f19b8c3.tar.gz qemu-667d22d1ae59da46b4c1fbd094ca61145f19b8c3.tar.xz qemu-667d22d1ae59da46b4c1fbd094ca61145f19b8c3.zip |
qdev: move bus removal to object_unparent
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 <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/object.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qemu/object.h b/include/qemu/object.h index be707f1a36..232463b3c7 100644 --- a/include/qemu/object.h +++ b/include/qemu/object.h @@ -230,6 +230,15 @@ typedef struct ObjectProperty } ObjectProperty; /** + * ObjectUnparent: + * @obj: the object that is being removed from the composition tree + * + * Called when an object is being removed from the QOM composition tree. + * The function should remove any backlinks from children objects to @obj. + */ +typedef void (ObjectUnparent)(Object *obj); + +/** * ObjectClass: * * The base for all classes. The only thing that #ObjectClass contains is an @@ -240,6 +249,8 @@ struct ObjectClass /*< private >*/ Type type; GSList *interfaces; + + ObjectUnparent *unparent; }; /** |