qom: object_delete should unparent the object first
commitda5a44e8b0b727681fc33e8d94832d1cae48a788
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 22 Aug 2012 21:09:46 +0000 (22 23:09 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 24 Aug 2012 01:19:59 +0000 (23 20:19 -0500)
tree05d07ea897538eed23cc86e097d43863f577bfeb
parent26efaca377e004b79ff50a6e936d029a0c095b8b
qom: object_delete should unparent the object first

object_deinit is only called when the reference count goes to zero,
and yet tries to do an object_unparent.  Now, object_unparent
either does nothing or it will decrease the reference count.
Because we know the reference count is zero, the object_unparent
call in object_deinit is useless.

Instead, we need to disconnect the object from its parent just
before we remove the last reference apart from the parent's.  This
happens in object_delete.  Once we do this, all calls to
object_unparent peppered through QEMU can go away.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/acpi_piix4.c
hw/qdev.c
hw/shpc.c
hw/xen_platform.c
qom/object.c