[newui] [PATCH] Check that Gtk.main is not already running before starting another one
Vratislav Podzimek
vpodzime at redhat.com
Fri Aug 3 12:28:01 UTC 2012
If python-meh catches an exception from a different thread before
GraphicalUserInterface's Gtk main loop is running, it runs its own
loop. Running another one from a different thread would cause Gtk
crash. So lets juts wait for the reboot.
---
pyanaconda/exception.py | 3 +++
pyanaconda/ui/gui/__init__.py | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 70deed5..00c1696 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -131,6 +131,9 @@ class AnacondaExceptionHandler(ExceptionHandler):
except SystemError:
pass
+ def runQuit(self, *args):
+ os.system("systemctl --no-wall reboot")
+
def initExceptionHandling(anaconda):
fileList = [ "/tmp/anaconda.log",
"/tmp/program.log", "/tmp/storage.log", "/tmp/ifcfg.log",
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 5887047..f130470 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -18,11 +18,12 @@
#
# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
#
-import importlib, inspect, os, sys
+import importlib, inspect, os, sys, time
import meh.ui.gui
from pyanaconda.ui import UserInterface
from pyanaconda.ui.gui.utils import enlightbox
+from pyanaconda.threads import threadMgr
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -87,6 +88,13 @@ class GraphicalUserInterface(UserInterface):
def run(self):
from gi.repository import Gtk
+ if Gtk.main_level() > 0:
+ # Gtk main loop running. That means python-meh caught exception
+ # and runs its main loop. Do not crash Gtk by running another one
+ # from a different thread and just wait for the reboot.
+ while True:
+ time.sleep(10000)
+
from pyanaconda.product import isFinal, productName, productVersion
# If we set these values on the very first window shown, they will get
--
1.7.11.2
More information about the anaconda-patches
mailing list