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

Chris Lumens clumens at redhat.com
Mon Aug 6 18:42:12 UTC 2012


> > 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.
> I believe we could use busy-wait here. Periodically (e.g. every 2
> seconds) test the Gtk.main_level() and when it falls to 0, run
> sys.exit(0). This way the exitHandler would be called at exit and we
> would not have to care about what thread crashed.

Yes, I guess you could do this.  I don't know that I like it over the
original code, though.

> Or we could write out the thread's name to a file in handleException,
> read it here and join the thread. Then run sys.exit(0). But this would
> be more complicated and I don't see any problem in a busy-wait in this
> case (exception appeared before UI started).

Yuck.  I'd definitely just prefer the original code to this.

One thing to keep in mind here is that we control the crashing behavior
of threads.  See AnacondaThread.run in threads.py.  So we can set flags
or signal other processes if we need to before running the exception
handler.

- Chris


More information about the anaconda-patches mailing list