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

Hash: SHA1

David Ne?as (Yeti) wrote:
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
- 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

I'm only interested in X. Any tips/hints/pointers on "locking X" ?


Thanks, I'll take a look.

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 thought occured to me. It's not a lot of gui I have to manage, but managing
it from a thread different from the one using it is a bit of a hassle.

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

i CHECKED the archives. honest. I did a search on $SUBJECT, and came up blank.
Maybe I need to broaden my search. Anyway, I'll look at the gdk-Threads doc.
Thanks for that!


gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

- --

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
Version: GnuPG v1.4.7 (GNU/Linux)


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