[PATCH] Check that Gtk.main is not already running before starting another one

Vratislav Podzimek vpodzime at redhat.com
Mon Aug 13 11:06:44 UTC 2012


I'd like to point out that we still don't have this issue resolved.

On Tue, 2012-08-07 at 15:03 +0200, Vratislav Podzimek wrote:
> 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/ui/gui/__init__.py | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
> index 5887047..15f82b8 100644
> --- a/pyanaconda/ui/gui/__init__.py
> +++ b/pyanaconda/ui/gui/__init__.py
> @@ -18,7 +18,7 @@
>  #
>  # 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
> @@ -87,6 +87,16 @@ 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 until python-meh is
> +            # finished, then quit.
> +            while Gtk.main_level() > 0:
> +                time.sleep(2)
> +
> +            sys.exit(0)
> +
>          from pyanaconda.product import isFinal, productName, productVersion
>  
>          # If we set these values on the very first window shown, they will get

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list