Re: Debian 6 with Sudden GTK application crash @ libGDK



On Tue, 09 Dec 2014 13:11:59 +0530
venkat <venkat s vortexindia co in> wrote:
[snip]

The problem is almost certainly in your approach to threading.  I
didn't even know that you could run the gtk+ main loop in other than
the main program thread and the one in which you called gtk_init().  

One obvious problem is that you have not surrounded gtk_main() by
gdk_threads_enter() and gdk_threads_leave().  You could try doing that,
and also do the same in respect of the call to gtk_init() (and
definitely make your call to gtk_init() after the call to
g_thread_init() so that glib threads have been initialized).  That may
or may not solve your problem. In any event, your example code only
works at present by chance.

Using the GDK global lock is of course now deprecated (in GTK+-3) and
the best thing is to rewrite the program using callbacks from worker
threads via g_idle_add() and cognates.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]