mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Fix exiting app if asyncjobs are running
This commit is contained in:
parent
b5baebf24c
commit
8914a61689
@ -303,13 +303,6 @@ class vmmAsyncJob(vmmGObjectUI):
|
|||||||
|
|
||||||
GLib.source_remove(timer)
|
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.topwin.destroy()
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
return self._error_info or (None, None)
|
return self._error_info or (None, None)
|
||||||
@ -321,10 +314,8 @@ class vmmAsyncJob(vmmGObjectUI):
|
|||||||
# dispatches with idle_add #
|
# dispatches with idle_add #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
def _exit_if_necessary(self, force_exit=False):
|
def _exit_if_necessary(self):
|
||||||
if not self._is_thread_active() or force_exit:
|
if not self._is_thread_active():
|
||||||
if self.async:
|
|
||||||
Gtk.main_quit()
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self._is_pulsing or not self.show_progress:
|
if not self._is_pulsing or not self.show_progress:
|
||||||
|
@ -407,6 +407,14 @@ class vmmEngine(vmmGObject):
|
|||||||
logging.debug("Leaked %s", name)
|
logging.debug("Leaked %s", name)
|
||||||
|
|
||||||
logging.debug("Exiting app normally.")
|
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)
|
self.application.remove_window(self._appwindow)
|
||||||
|
|
||||||
def _create_inspection_thread(self):
|
def _create_inspection_thread(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user