On 01/10/2017 01:23 AM, Wang King wrote:
Probably causes 'vm' to be disposed in execute
qemuProcessAutoDestroy
callback function, reference 'vm' avoid unlock disposed object.
Signed-off-by: Wang King <king.wang(a)huawei.com>
---
src/util/virclosecallbacks.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
I don't see how getting an extra Ref resolves the issue...
Let's see how 2/3 falls out, but I think this one is dropped.
John
diff --git a/src/util/virclosecallbacks.c
b/src/util/virclosecallbacks.c
index 633b22c..ab11e95 100644
--- a/src/util/virclosecallbacks.c
+++ b/src/util/virclosecallbacks.c
@@ -337,18 +337,20 @@ virCloseCallbacksRun(virCloseCallbacksPtr closeCallbacks,
for (i = 0; i < list->nentries; i++) {
virDomainObjPtr vm;
+ virDomainObjPtr dom;
- if (!(vm = virDomainObjListFindByUUID(domains,
- list->entries[i].uuid))) {
+ if (!(vm = virDomainObjListFindByUUIDRef(domains,
+ list->entries[i].uuid))) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(list->entries[i].uuid, uuidstr);
VIR_DEBUG("No domain object with UUID %s", uuidstr);
continue;
}
- vm = list->entries[i].callback(vm, conn, opaque);
- if (vm)
- virObjectUnlock(vm);
+ dom = list->entries[i].callback(vm, conn, opaque);
+ if (dom)
+ virObjectUnlock(dom);
+ virObjectUnref(vm);
}
virObjectLock(closeCallbacks);