[PATCH 3/3] Use threadMgr to wait for exception handling to finish
Vratislav Podzimek
vpodzime at redhat.com
Mon Jan 12 14:04:44 UTC 2015
If an exception appears in a non-main thread prior to GUI being started,
python-meh or our own error handling code start a Gtk main loop in such a
thread. We need to wait for such main loop to finish instead of running another
one in the main thread. But even if python-meh or our error handling code call
sys.exit(), the process doesn't exit because the main thread is still running
and it is not a daemon thread. Thus we need to wait for the exception handling
code to finish and then exit the process from the main thread.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ui/gui/__init__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index bd6941d..b189350 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -28,6 +28,7 @@ from gi.repository import Gdk, Gtk, AnacondaWidgets, Keybinder, GdkPixbuf, GLib,
from pyanaconda.i18n import _
from pyanaconda.constants import IPMI_ABORTED
from pyanaconda import product, iutil
+from pyanaconda import threads
from pyanaconda.ui import UserInterface, common
from pyanaconda.ui.gui.utils import gtk_action_wait, busyCursor, unbusyCursor
@@ -648,9 +649,8 @@ class GraphicalUserInterface(UserInterface):
log.error("Unhandled exception caught, waiting for python-meh to "\
"exit")
- # Loop forever, meh will call sys.exit() when it's done
- while True:
- time.sleep(10000)
+ threads.threadMgr.wait_for_error_threads()
+ sys.exit(1)
# Apply a widget-scale to hidpi monitors
self._widgetScale()
--
2.1.0
More information about the anaconda-patches
mailing list