Re: gtk_label_set_text() not working .



> hi all,
>                       I'am a newbie here. i'am developing a user agent
> client , for a Telephony application using GTK+-1.2. The whole
> application has 5 threads running , i try to update a label , with
> gtk_label_set_text () , when some event occurs in the application , but
> it doesnt seem to take affect . When i use it with a debugger and when i
> single step code , everything appears to be fine . Could someone help me
> to overcome this problem.

Read the threads section of the api-manual of gtk and gdk, and the usage
of gdk_threads_enter() and gdk_threads_leave(). Sounds very like thread
race problem. For all glib events, you need to call
gdk_threads_enter()/gdk_threads_leave by hand. Events that comes from gtk,
already holds this lock.

gtk main looks like this

while (!quit)
{
 gdk_threads_leave(); /* unlock */
 let_glib_run_until_we_have_a_event;
 gdk_threads_enter(); /* lock*/
 handle_events;
}

Stian



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