[master] [PATCH] Do not exit if there are some threads still running

Vratislav Podzimek vpodzime at redhat.com
Tue Oct 23 11:43:48 UTC 2012


This makes kickstart installations work. Without this patch code
in pyanaconda/ui/gui/hubs/__init__.py/_update_spokes() exits
anaconda 1 second after going to progress hub.

This should definitely be resolved in a better way, but still we shouldn't
call sys.exit() when we have some threads still running.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/threads.py         | 6 ++++++
 pyanaconda/ui/gui/__init__.py | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/threads.py b/pyanaconda/threads.py
index 55fe141..1e3940e 100644
--- a/pyanaconda/threads.py
+++ b/pyanaconda/threads.py
@@ -66,6 +66,12 @@ class ThreadManager(object):
         """
         return self._objs.get(name)
 
+    @property
+    def have_running_threads(self):
+        """Returns whether there are any running threads or not."""
+
+        return bool(self._objs)
+
 class AnacondaThread(threading.Thread):
     """A threading.Thread subclass that exists only for a couple purposes:
 
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index fa80e6d..bf78ae5 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -25,6 +25,7 @@ from gi.repository import Gdk
 
 from pyanaconda.ui import UserInterface, common
 from pyanaconda.ui.gui.utils import enlightbox, gtk_thread_wait
+from pyanaconda.threads import threadMgr
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -173,9 +174,11 @@ class GraphicalUserInterface(UserInterface):
     ### SIGNAL HANDLING METHODS
     ###
     def _on_continue_clicked(self):
-        # If we're on the last screen, clicking Continue quits.
+        # If we're on the last screen and there are no threads running,
+        # clicking Continue quits.
         if len(self._actions) == 1:
-            sys.exit(0)
+            if not threadMgr.have_running_threads:
+                sys.exit(0)
             return
 
         ndx = 0
-- 
1.7.11.7



More information about the anaconda-patches mailing list