31875e5
# HG changeset patch
31875e5
# User Cole Robinson <crobinso@redhat.com>
31875e5
# Date 1264526673 18000
31875e5
# Node ID 3fc51aee7be3c5d539ad9ed1f90afdcd43de8896
31875e5
# Parent  0ade95843eba86c51247645be001cc336fd99966
31875e5
engine: Make sure a libvirtd restart doesn't lock the app
31875e5
31875e5
We were trying to close the connection without thread locking (and closing
31875e5
can emit a signal which updates the UI).
31875e5
31875e5
diff -r 0ade95843eba -r 3fc51aee7be3 src/virtManager/engine.py
31875e5
--- a/src/virtManager/engine.py	Mon Jan 25 10:04:31 2010 -0500
31875e5
+++ b/src/virtManager/engine.py	Tue Jan 26 12:24:33 2010 -0500
31875e5
@@ -211,8 +211,9 @@
31875e5
 
31875e5
     def _tick(self):
31875e5
         for uri in self.connections.keys():
31875e5
+            conn = self.connections[uri]["connection"]
31875e5
             try:
31875e5
-                self.connections[uri]["connection"].tick()
31875e5
+                conn.tick()
31875e5
             except KeyboardInterrupt:
31875e5
                 raise
31875e5
             except libvirt.libvirtError, e:
31875e5
@@ -220,7 +221,7 @@
31875e5
                     logging.exception("Could not refresh connection %s." % uri)
31875e5
                     logging.debug("Closing connection since libvirtd "
31875e5
                                   "appears to have stopped.")
31875e5
-                    self.connections[uri]["connection"].close()
31875e5
+                    gobject.idle_add(conn.close)
31875e5
                 else:
31875e5
                     raise
31875e5
         return 1