James Henstridge <[EMAIL PROTECTED]> writes:
> I have heard about this problem before, and am looking into it. It only
> seems to occur when thread support is enabled (note that no threads need
> be created for the problem to occur).
I suspected that it has something to do with threading :-/ That's why
explicitly mentioned that the python and therefore gtk had threadig
enabled.
> I don't have a solution at present.
Well, I have one now. At least it's a work-around.
The problem seem to be missing calls to GDK_THREADS_LEAVE and
GDK_THREADS_ENTER. I put them around the calls to gtk_main_iteration and
gtk_events_pending and the problem vanished. E.g. the wrapper for
gtk_main_iteration_do becomes:
static PyObject *_wrap_gtk_main_iteration(PyObject *self, PyObject *args) {
int block = 1, ret;
if(!PyArg_ParseTuple(args,"|i:gtk_main_iteration", &block))
return NULL;
PyGTK_UNBLOCK_THREADS
GDK_THREADS_LEAVE ();
ret = gtk_main_iteration_do(block);
GDK_THREADS_ENTER ();
PyGTK_BLOCK_THREADS
#ifdef WITH_THREAD
g_assert(_blockcount == 1);
_blockcount = 1;
#endif
return PyInt_FromLong(ret);
}
I think it's really a bug in gtk, because gtk_main in gtkmain.c uses the
GDK_THREADS_* macros around the call g_main_run while
gtk_main_iteration_do and gtk_events_pending don't do that for the calls
to g_main_iteration and g_main_pending respectively.
Bernhard
--
Bernhard Herzog | Sketch, a python based drawing program
[EMAIL PROTECTED] | http://www.online.de/home/sketch/
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]