[pygtk] Accessibility hang when GTK's main loop is in a second thread (PyGTK)

Laszlo Pandy laszlok2 at gmail.com
Wed Jun 24 22:38:52 WST 2009


GTK isn't thread safe, but it does have a global lock. See the link
below for more details:
http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness.html

Also remember, when using threads with Python and PyGTK you must call
gtk.gdk.threads_init() or else you'll get all sorts of race conditions
in the Python interpreter.

Laszlo

On Thu, Jun 18, 2009 at 6:04 PM, Timothy Renner<timothy.renner at gmail.com> wrote:
> We have a Python application using PyGTK, which fires up a second
> thread for the GUI and gtk.main() while main processing happens in the
> Main thread.  Main is responsible for much of the actual drawing of
> the GUI, while the secondary thread is responsible for picking up
> actions on the GUI and prodding the main thread into the appropriate
> responses.  This has been working beautifully with accessibility
> disabled, and under older versions of GTK.
>
> However, we're running into the problem of the application freezing
> when accessibility is enabled on newer systems (Ubuntu 8.10+ as far as
> I can tell.)  I've narrowed it down to which thread gtk.main() is
> executed in.  If it's the main thread, there are no problems.  If it's
> in the secondary thread, then as soon as the window loses focus, it
> hangs.  Not only does it hang, but the idle functions that I've
> registered with gobject.idle_add(...) will get through one more
> iteration and then never execute again.  It looks like something is
> deadlocking in glib's or gtk's internals when this happens.
>
> Is running in a secondary thread simply not allowed at the moment?
> I'd prefer to find a solution that allows us to keep our current
> structure rather than juggling our threads, but if it must be changed,
> that's acceptable.  At the very least, I'd like to understand better
> the technical details of how GNOME accessibility is interacting with
> our program.
>
> Thanks for your time,
> -Tim
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>


More information about the pygtk mailing list