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

Vratislav Podzimek vpodzime at redhat.com
Mon Aug 6 09:12:51 UTC 2012


On Fri, 2012-08-03 at 14:44 -0400, Chris Lumens wrote:
> > 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",
> 
> I think runQuit need to use the same kind of code we do elsewhere to
> make sure anaconda's exitHandler function gets run.  I'd like to make
> sure every way out of anaconda passes through that function.
Could you please point me at such "elsewhere" place in the code?
sys.exit(0) doesn't work here. Should runQuit invoke exitHandler
directly? 

> 
> > @@ -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
> 
> Seems a bit ungraceful, but at least there's a helpful comment.  The
> best alternative I can suggest is joining on a thread but you'd have to
> figure out which one to join on first.
Yeah, I don't like it either, but I didn't find any better way to do it.
Joining (all) threads was one of my attempts too, but it didn't work. If
that worked, we wouldn't need the runQuit, because we could just join
all threads here and call sys.exit(0), that would reboot the system. I
will do some more attempts. If none of them work, I will at least add
the line logging the issue to this patch.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list