diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-08-22 23:09:46 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-23 20:19:59 -0500 |
commit | da5a44e8b0b727681fc33e8d94832d1cae48a788 (patch) | |
tree | 05d07ea897538eed23cc86e097d43863f577bfeb /hw/qdev.c | |
parent | 26efaca377e004b79ff50a6e936d029a0c095b8b (diff) | |
download | qemu-da5a44e8b0b727681fc33e8d94832d1cae48a788.zip qemu-da5a44e8b0b727681fc33e8d94832d1cae48a788.tar.gz qemu-da5a44e8b0b727681fc33e8d94832d1cae48a788.tar.bz2 |
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>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -159,7 +159,6 @@ int qdev_init(DeviceState *dev) rc = dc->init(dev); if (rc < 0) { - object_unparent(OBJECT(dev)); qdev_free(dev); return rc; } @@ -243,7 +242,6 @@ void qbus_reset_all_fn(void *opaque) int qdev_simple_unplug_cb(DeviceState *dev) { /* just zap it */ - object_unparent(OBJECT(dev)); qdev_free(dev); return 0; } |