summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2013-06-14 11:24:32 -0400
committerCole Robinson <crobinso@redhat.com>2013-06-14 11:24:52 -0400
commit8914a61689b386451e86220a43e4de5b3776f942 (patch)
treefea8ac2d0bcc1383be8307167fc566702e2864d4
parentb5baebf24ccaed53edc7c44ff2b1af5f4a286082 (diff)
downloadvirt-manager-8914a61689b386451e86220a43e4de5b3776f942.tar.gz
Fix exiting app if asyncjobs are running
-rw-r--r--virtManager/asyncjob.py13
-rw-r--r--virtManager/engine.py8
2 files changed, 10 insertions, 11 deletions
diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
index f83ec39c..e3104ce9 100644
--- a/virtManager/asyncjob.py
+++ b/virtManager/asyncjob.py
@@ -303,13 +303,6 @@ class vmmAsyncJob(vmmGObjectUI):
GLib.source_remove(timer)
- if self._bg_thread.isAlive():
- # This can happen if the user closes the whole app while the
- # async dialog is running. This forces us to clean up properly
- # and not leave a dead process around.
- logging.debug("Forcing main_quit from async job.")
- self._exit_if_necessary(force_exit=True)
-
self.topwin.destroy()
self.cleanup()
return self._error_info or (None, None)
@@ -321,10 +314,8 @@ class vmmAsyncJob(vmmGObjectUI):
# dispatches with idle_add #
####################################################################
- def _exit_if_necessary(self, force_exit=False):
- if not self._is_thread_active() or force_exit:
- if self.async:
- Gtk.main_quit()
+ def _exit_if_necessary(self):
+ if not self._is_thread_active():
return False
if not self._is_pulsing or not self.show_progress:
diff --git a/virtManager/engine.py b/virtManager/engine.py
index c0585e15..bca14cf3 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -407,6 +407,14 @@ class vmmEngine(vmmGObject):
logging.debug("Leaked %s", name)
logging.debug("Exiting app normally.")
+
+ # We need this if there are any asyncdialog fobjs running
+ if Gtk.main_level():
+ logging.debug("%s other gtk main loops running, killing them.",
+ Gtk.main_level())
+ for ignore in range(Gtk.main_level()):
+ Gtk.main_quit()
+
self.application.remove_window(self._appwindow)
def _create_inspection_thread(self):