summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2013-06-18 09:01:45 -0400
committerCole Robinson <crobinso@redhat.com>2013-06-18 09:01:45 -0400
commitf3e061da36fa6b0a6b3fb3227612339684dfb5d3 (patch)
treee064f65c770751642ce927661ca4fde2b36d4ec7
parent1c8bf88db78ff7eb4279edd760c6d6fdd14e3234 (diff)
downloadvirt-manager-f3e061da36fa6b0a6b3fb3227612339684dfb5d3.tar.gz
asyncjob: Fix tracebacks if main loop exits early
Our use of nested mainloops is still kinda wonky and a proper solution will take some decent effort. Deal with the fact that a main loop might exit before the thread completes, and the thread will try to talk to resources that no longer exist.
-rw-r--r--virtManager/asyncjob.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
index 1e6f6d40..6169441c 100644
--- a/virtManager/asyncjob.py
+++ b/virtManager/asyncjob.py
@@ -301,8 +301,6 @@ class vmmAsyncJob(vmmGObjectUI):
else:
self._bg_thread.run()
- GLib.source_remove(timer)
-
self.topwin.destroy()
self.cleanup()
return self._error_info or (None, None)
@@ -328,17 +326,23 @@ class vmmAsyncJob(vmmGObjectUI):
@idle_wrapper
def _pbar_do_pulse(self):
+ if not self.builder:
+ return
self.widget("pbar").pulse()
@idle_wrapper
def _pbar_pulse(self, progress="", stage=None):
self._is_pulsing = True
+ if not self.builder:
+ return
self.widget("pbar").set_text(progress)
self._set_stage_text(stage or _("Processing..."))
@idle_wrapper
def _pbar_fraction(self, frac, progress, stage=None):
self._is_pulsing = False
+ if not self.builder:
+ return
self._set_stage_text(stage or _("Processing..."))
self.widget("pbar").set_text(progress)
@@ -351,6 +355,8 @@ class vmmAsyncJob(vmmGObjectUI):
@idle_wrapper
def _pbar_done(self, progress, stage=None):
self._is_pulsing = False
+ if not self.builder:
+ return
self._set_stage_text(stage or _("Completed"))
self.widget("pbar").set_text(progress)
self.widget("pbar").set_fraction(1)