On Wed, 04 Jul 2012 13:18:18 +0200 "Martin Schlemmer" <Martin.Schlemmer@xxxxxxxxx> wrote: > >>> On 7/4/2012 at 10:30 AM, Chris Vine <chris@xxxxxxxxxxxxxxxxxxxxx> > wrote: [snip] > > GTK+/GDK has never been thread-safe on Win32. If the GDK global > lock > > appeared to work for you in the past you just got lucky. From the > > documentation at > > http://developer.gnome.org/gdk/stable/gdk-Threads.html : > > > > "GTK+ is "thread aware" but not thread safe * it provides a global > lock > > controlled by gdk_threads_enter()/gdk_threads_leave() which protects > > all use of GTK+. That is, only one thread can use GTK+ at any given > > time. > > > > "Unfortunately the above holds with the X11 backend only. With the > Win32 > > backend, GDK calls should not be attempted from multiple threads at > > all." > > > > In due course > gdk_threads_init()/gdk_threads_enter()/gdk_threads_leave() > > are to be deprecated in the X11 backend, although that is not > relevant > > to your code. > > > > Win32 users (and in due course X11 users) should use > > g_idle_add()/g_idle_add_full() to send event callbacks from worker > > threads to the gui thread which invoke the GTK+ functions you want > to > > call. With glib < 2.32, you will need to call g_thread_init() > > (g_thread_init() is not needed on glib >= 2.32 and is a no-op.) > This > > also happens to be a much cleaner design than using the GDK global > lock. > > > > The FAQ on this is, I agree, misleading - I should file a > documentation > > bug. > > > > I understand this, and that is why I modified the example to do > exactly that - use g_idle_add(). It didn't. The code you posted makes calls to gdk_threads_init(), gdk_threads_enter(), gdk_threads_leave() and gdk_threads_add_idle(). As I have said, it is pointless trying to invoke the GDK lock (which these do) in Win32 and in your case seems to have created a deadlock. Remove these gdk calls, refactor your code to pass events, use g_thread_init() and g_idle_add(), and it should work. Chris _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list