mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 10:25:25 +03:00
Fix a nasty thread locking problem during startup if an error dialog needs to be shown
This commit is contained in:
parent
b1c8701c2e
commit
b9a392832a
@ -140,19 +140,8 @@ def show_engine(engine, show, uri, uuid):
|
||||
else:
|
||||
tryuri = "qemu:///session"
|
||||
if tryuri is not None:
|
||||
try:
|
||||
engine.connect_to_uri(tryuri)
|
||||
except:
|
||||
(type, value, stacktrace) = sys.exc_info ()
|
||||
|
||||
# Detailed error message, in English so it can be Googled.
|
||||
details = \
|
||||
("Unable to open auto-open connection to hypervisor URI '%s':\n" %
|
||||
str(tryuri)) + \
|
||||
str(type) + " " + str(value) + "\n" + \
|
||||
traceback.format_exc (stacktrace)
|
||||
logging.warning(details)
|
||||
|
||||
conn = engine.connect_to_uri(tryuri)
|
||||
if conn is None:
|
||||
tryuri = None
|
||||
if tryuri is None:
|
||||
engine.show_connect()
|
||||
@ -239,17 +228,17 @@ def main():
|
||||
str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
|
||||
|
||||
# Finally start the app for real
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
show_engine(engine, options.show, options.uri, options.uuid)
|
||||
if options.profile != None:
|
||||
import hotshot
|
||||
prof = hotshot.Profile(options.profile)
|
||||
gtk.gdk.threads_enter()
|
||||
prof.runcall(gtk.main)
|
||||
gtk.gdk.threads_leave()
|
||||
prof.close()
|
||||
else:
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
finally:
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -65,7 +65,7 @@ class vmmEngine:
|
||||
self.windowManager.disconnect_connection(hvuri)
|
||||
|
||||
def connect_to_uri(self, uri, readOnly=None):
|
||||
self._connect_to_uri(None, uri, readOnly)
|
||||
return self._connect_to_uri(None, uri, readOnly)
|
||||
|
||||
def _connect_to_uri(self, connect, uri, readOnly):
|
||||
self.windowConnect = None
|
||||
@ -73,6 +73,7 @@ class vmmEngine:
|
||||
try:
|
||||
conn = self.get_connection(uri, readOnly)
|
||||
self.show_manager()
|
||||
return conn
|
||||
except:
|
||||
(type, value, stacktrace) = sys.exc_info ()
|
||||
|
||||
@ -111,9 +112,7 @@ class vmmEngine:
|
||||
dg.run()
|
||||
dg.hide()
|
||||
dg.destroy()
|
||||
|
||||
if len(self.connections.keys()) == 0:
|
||||
gtk.main_quit()
|
||||
return None
|
||||
|
||||
def _connect_cancelled(self, connect):
|
||||
self.windowConnect = None
|
||||
|
Loading…
Reference in New Issue
Block a user