Re: Calling GUI function from Thread



On Sat, 8 Sep 2007, Taha Ali <tahaarifali gmail com> wrote :
I am facing problem in calling a gui function from a thread.

Don't do that.

I am trying to set_text these messages in a label but after
first normal execution of this thread, the gui hangs on the next call. 

So don't do that.

When I dont try to set_text any
thing from this callback function, it works just fine showing me the
display (std::cout) on the screen.

So don't do that!

Need help.

OK, incase you haven't already guessed, the answer is DON'T call GTK from a thread. It doesn't like it at all.

The function in your thread should use Glib::Dispatcher (or g_idle_add) to ask the main (gui) thread to set the text.
--
Rob Pearce                       http://www.bdt-home.demon.co.uk

The contents of this | Windows NT crashed.
message are purely   | I am the Blue Screen of Death.
my opinion. Don't    | No one hears your screams.
believe a word.      |



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