I have written a Python binding [1] to Tomboy's global keybinding code
(written in C).  And it all works fine.  Mostly.

If my python app calls
        gtk.gdk.threads_init()
earlier, however, then it segfaults somewhere in the PyEval_CallObject
of:
--------------------
void handler_c_func (char *keystring, gpointer user_data)
{
        Handler_and_Args *ha = (Handler_and_Args *) user_data;
        PyObject *result = PyEval_CallObject(ha->handler, ha->args);
        if (result == NULL) {
                if (PyErr_Occurred()) {
                        PyErr_Print();
                }
        } else {
                Py_DECREF(result);
        }
}
--------------------

If I add gdk_threads_enter() and gdk_threads_leave() just before and
after the "PyObject *result = ..." line, then it doesn't segfault, but
just blocks at the gdk_threads_enter.  I tried messing around with
Py_BEGIN_ALLOW_THREADS, and alternatively having handler_c_func calling
g_idle_add, but both of those didn't seem to work.

Any ideas?

Thanks in advance,
Nigel.


[1] http://cvs.gnome.org/viewcvs/deskbar-applet/deskbar/keybinder/
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to