The caller should take care of it. In this case the caller is
default event loop implementation. Actually this can be complicated
because error callback can trigger unreferencing the monitor.
But first this is done at the end anyway when we drop reference already,
second current default loop implementation defers deleting handles
and this is for ages because this implementation is public
API [1]. So we have reference while we are in this call.
[1]
https://www.redhat.com/archives/libvir-list/2016-September/msg01005.html
---
src/qemu/qemu_agent.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 36bc7c7..6aaacfd 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -599,7 +599,6 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
virDomainObjPtr vm;
virErrorPtr err;
- virObjectRef(mon);
/* lock access to the monitor and protect fd */
virObjectLock(mon);
#if DEBUG_IO
@@ -609,7 +608,6 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
/* this is not interesting at all */
if (mon->lastError.code != VIR_ERR_OK) {
virObjectUnlock(mon);
- virObjectUnref(mon);
return;
}
@@ -672,7 +670,6 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
qemuAgentUpdateWatch(mon);
virObjectUnlock(mon);
- virObjectUnref(mon);
return;
error:
@@ -697,7 +694,6 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
virObjectUnlock(mon);
- virObjectUnref(mon);
(errorNotify)(mon, vm);
}
--
1.8.3.1