Re: Xlib: unexpected async reply (sequence #####)!



On Sat, Aug 04, 2007 at 09:38:25PM +0800, Gregory Hosler wrote:
I have a threaded gtk application. The threads create some gui (gtk
widgets/windows). and most of the time (maybe 80%) everything works as expected.
Occassionally I will get the message on stdout

      Xlib: unexpected async reply (sequence #####)!

the ### is an x event sequence number

I am suspecting that this is because of the x calls from 2 different threads.

Is this a known problem?

Any way around this ? (I thought gtk was supposed to be thread ok :)

The answer depends on your defintions of `OK', `known' and
`problem':
- Gtk+ is thread-aware
- Gtk+ is not thread-safe

If you operate on the GUI from multiple threads:
- you are responsible for the locking on Unix/X
- it will just not work on MS Windows

See

  http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html

People typically operate on the GUI only from the main
thread (i.e. running gtk_main()) and pass work requests to
it via g_idle_add() or some other queue mechanism.

This topic is discussed here every other week, see the list
archives.

Yeti

--
http://gwyddion.net/



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