Hi,
I've created some applications using PyGTK and thought they had been
OK until I executed them in an environment with accessibility
enabled (GNOME on Ubuntu and Openbox on Debian). I've found out they
hang and what is more frustrating - they cause AT-SPI applications
to hang.
I've created a repo[1] with all variants of using PyGTK with
threads I could think of:
- primarythread prefix means gtk.main() works inside the primary
thread (one executed first by Python)
- secondarythread prefix means gtk.main() works inside the secondary
thread.
- gobject suffix means only gobject.threads_init() has been used,
- gtkgdk suffix means both gobject and gtk.gdk.threads_init() have
been used,
- import suffix means "import gtk" is executed inside the new thread.
showApps.py[2] is an example of an application using AT-SPI to list
applications with accessibility enabled.
I've summarized tests in the table below (also inside the README[3]
file):
"Hang" column indicates if the GTK application has hung.
"Listed" column indicates if the application is visible in the AT-SPI
listing.
| hang | listed |
----------------------------------+----------+--------+
primarythread_gobject.py | no | yes |
primarythread_gtkgdk.py | no | yes |
secondarythread_gobject_import.py | no [1] | yes |
secondarythread_gobject.py | yes | hang |
secondarythread_gtkgdk_import.py | no [1] | yes |
secondarythread_gtkgdk.py | yes | hang |
[1] ** (secondarythread_gobject_import.py:5828): CRITICAL **:
giop_thread_request_push: assertion `tdata != NULL' failed
-- at the application termination
When AT-SPI is marked "hang" it hangs unconditionally during
applications listing.
Hanging of the PyGTK application happens for example after losing and
regaining focus by its window.
Test showed that no problems occur when gtk.main() is run from the
first/main Python thread. But this doesn't satisfy me as I don't like
treating GUI as the main part of the application.
My questions are:
1. Is there anything wrong with code in programs marked as
secondarythread? Or is it a bug in GTK/GAIL/AT-SPI?
2. Is there a policy that prohibits running gtk.main() outside the
first/main Python thread?
I've asked the same questions at the StackOverflow[4].
I've also seen a very similar post at this mailing list[5]. But as a
response only a suggestion to use gtk.gdk.threads_init() has been made.
I've used that one already.
[1] https://bitbucket.org/wodny/pygtk-threads
[2] https://bitbucket.org/wodny/pygtk-threads/src/210f9d9b3b60/showApps.py
[3] https://bitbucket.org/wodny/pygtk-threads/src/210f9d9b3b60/README
[4]
http://stackoverflow.com/questions/7010004/pygtk-threads-and-accessibility-application-hangs
[5] http://www.daa.com.au/pipermail/pygtk/2009-June/017188.html
--
Marcin Szewczyk http://wodny.org
mailto:[email protected] <- remove b / usuĊ b
xmpp:[email protected] xmpp:[email protected]
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/