On 03/31/2013 10:20 AM, Peter Krempa wrote:
From: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
Before closing the connection we unregister the close callback
to prevent a reference leak.
Further, the messages on virConnectClose != 0 are a bit more specific
now.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
tools/virsh.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
ACK.
Thanks to patch 2/6, you could now technically close the connection
first, then unregister the callback, and the reference held by the
callback will ensure that the connection lives long enough to let that
work even after things were "closed". Most likely to happen if things
are multithreaded, where one thread is unregistering while another
thread is closing the connection. But given that earlier libvirt had
problems, we obviously don't want to advertise that "backwards" approach
to cleanup.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org