[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 32/43] qom: fix refcount of non-heap-allocated obje
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 32/43] qom: fix refcount of non-heap-allocated objects |
Date: |
Mon, 3 Dec 2012 16:25:48 -0600 |
From: Paolo Bonzini <address@hidden>
The reference count for embedded objects is always one too low, because
object_initialize_with_type returns with zero references to the object.
This causes premature finalization of the object (or an assertion failure)
after calling object_ref to add an extra reference and object_unref to
remove it.
The fix is to move the initial object_ref call from object_new_with_type
to object_initialize_with_type.
Acked-by: Andreas Färber <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 764b63125a77dab54ed405d493452a4e05679c2e)
Signed-off-by: Michael Roth <address@hidden>
---
qom/object.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qom/object.c b/qom/object.c
index f33e84d..5499318 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -307,6 +307,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
memset(obj, 0, type->instance_size);
obj->class = type->class;
+ object_ref(obj);
QTAILQ_INIT(&obj->properties);
object_init_with_type(obj, type);
}
@@ -395,7 +396,6 @@ Object *object_new_with_type(Type type)
obj = g_malloc(type->instance_size);
object_initialize_with_type(obj, type);
- object_ref(obj);
return obj;
}
--
1.7.9.5
- [Qemu-stable] [PATCH 18/43] m68k: Return semihosting errno values correctly, (continued)
- [Qemu-stable] [PATCH 18/43] m68k: Return semihosting errno values correctly, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 20/43] mips/malta: fix CBUS UART interrupt pin, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 21/43] target-mips: fix wrong microMIPS opcode encoding, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 23/43] tcg/arm: fix cross-endian qemu_st16, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 25/43] configure: avoid compiler warning in pipe2 detection, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 22/43] tcg/arm: fix TLB access in qemu-ld/st ops, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 24/43] target-openrisc: remove conflicting definitions from cpu.h, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 28/43] block: Fix regression for MinGW (assertion caused by short string), Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 34/43] qapi: fix qapi_dealloc_type_size parameter type, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 33/43] qapi: handle visitor->type_size() in QapiDeallocVisitor, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 35/43] iscsi: fix segfault in url parsing, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 36/43] iscsi: fix deadlock during login, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 37/43] iscsi: do not assume device is zero initialized, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 38/43] virtio-scsi: Fix some endian bugs with virtio-scsi, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 39/43] virtio-scsi: Fix subtle (guest) endian bug, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 40/43] qxl: reload memslots after migration, when qxl is in UNDEFINED mode, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 41/43] usb: fail usbdevice_create() when there is no USB bus, Michael Roth, 2012/12/03