Re: Simple Error



You're right, it is a simple error, in that, the solution is simple.

First scour the mail archives, this comes up from time to time and has been thoroughly discussed.

But briefly,
  1. Do no drawing to the screen in threads other than main
  2. When the thread is ready to draw, use g_idle_add() to put a function on the gtk main loop queue to do/invoke the drawing command.
That's it basically.  Things can get tricky, as always with threads, but follow the above two rules and there's always a solution to be found.

richard


On 6/24/07, Justin Hart <justinhart gmail com> wrote:
I haven't done much GTK programming, so I seem to have tripped over
something.  Can somebody help clarify what I should do?

I have a thread running.  Every now and again, it updates an image
that I want to put into a drawing area.  That all works fine, except
that I get this error message.  It's apparently because I'm not
supposed to do this drawing in a thread other than the one with the
gtk_main.

Xlib: unexpected async reply (sequence 0xd6)!

So, I hacked around a bit and wrote a little widget class, it updates
this image when it receives a signal.  I use the thread causing the
problem to send the signal.  So, of course, I figure that this is
fine, and that the signal is picked up in gtk_main.

I guess I was mistaken, since the error remains.  Can anybody
enlighten me as to what I'm doing wrong?
--
Justin W. Hart
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list



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