mirror of
https://github.com/virt-manager/virt-manager.git
synced 2026-08-10 04:58:08 -05:00
connection: Call virConnectClose and log the return value
This can help us find object leaks within the code. virConnectClose is just a deference and will return 1 if other references are still floating around.
This commit is contained in:
@@ -986,7 +986,6 @@ class vmmConnection(vmmGObject):
|
||||
self._storage_pool_cb_ids = []
|
||||
self._node_device_cb_ids = []
|
||||
|
||||
self._backend.close()
|
||||
self._stats = []
|
||||
|
||||
if self._init_object_event:
|
||||
@@ -995,6 +994,11 @@ class vmmConnection(vmmGObject):
|
||||
self._objects.cleanup()
|
||||
self._objects = _ObjectList()
|
||||
|
||||
closeret = self._backend.close()
|
||||
if closeret == 1 and self.config.test_leak_debug:
|
||||
logging.debug("LEAK: conn close() returned 1, "
|
||||
"meaning refs may have leaked.")
|
||||
|
||||
self._change_state(self._STATE_DISCONNECTED)
|
||||
self._closing = False
|
||||
|
||||
|
||||
@@ -478,7 +478,7 @@ class vmmEngine(vmmGObject):
|
||||
objs.remove(src.object_key)
|
||||
|
||||
for name in objs:
|
||||
logging.debug("Leaked %s", name)
|
||||
logging.debug("LEAK: %s", name)
|
||||
|
||||
logging.debug("Exiting app normally.")
|
||||
self._application.quit()
|
||||
|
||||
@@ -118,9 +118,13 @@ class VirtualConnection(object):
|
||||
return not bool(self._libvirtconn)
|
||||
|
||||
def close(self):
|
||||
ret = 0
|
||||
if self._libvirtconn:
|
||||
ret = self._libvirtconn.close()
|
||||
self._libvirtconn = None
|
||||
self._uri = None
|
||||
self._fetch_cache = {}
|
||||
return ret
|
||||
|
||||
def fake_conn_predictable(self):
|
||||
return self._fake_conn_predictable
|
||||
|
||||
Reference in New Issue
Block a user