I've been getting python thread deaths in an application which uses gtk
ListStores that maintain references to python objects.
isolated the problem to this example code:
--
import pygtk
pygtk.require("2.0")
import gc
import gobject
import gtk
class Foo:
pass
list_store = gtk.ListStore(gobject.TYPE_PYOBJECT)
list_store.prepend((Foo(),))
gtk.threads_init()
list_store = None
gc.collect()
--
results in the message:
"Fatal Python error: PyThreadState_Get: no current thread
Aborted"
I get this with libgtk2 2.2.0, and pygtk-2.0.0 or the CVS HEAD version
of pygtk.
Stepping through the pygtk code in a debugger suggests that the callback
to pygtk from gtk to free the item in the ListStore wasn't grabbing the
python GIL.
This patch to gobjectmodule.c fixed the problem for me:
static void
pyobject_free(gpointer boxed)
{
PyObject *object = boxed;
+ pyg_block_threads();
Py_DECREF(object);
+ pyg_unblock_threads();
}
Looks like a bug to me but I may be misusing the pygtk API or
misunderstanding gtk?
Thanks,
Graham
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/