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

Re: Xlib: unexpected async reply (sequence 0x1686)!



Am Donnerstag, 18. April 2002 20:20 schrieb Eric Shorkey:
> The problem is that gtk is thread aware, but not thread safe. So every
> time you alter the state of a widget from a different thread, you risk
> hitting an 'Xlib: unexpected async reply'. The only solution is to call
> gdk_threads_init() before you call gtk_init(), and then you must call
> gdk_threads_enter() before you make any gtk calls that are not within a
> gtk callback, and then you call gtk_threads_leave() when you are
> finished.
>
> There is a section on threads in the GDK manual.
> (http://developer.gnome.org/doc/API/2.0/gdk/gdk-threads.html) Read it,
> and you will understand. :) Threading in GTK can be tricky.
>
Thanks Eric, I have already read this document and managed to fix the 
problem. Now I encounter sth. very strange, I make a gdk_enter () and call a 
function that should load a Widget into a GtkWidget* variable, but after the 
gdk_leave() my variable is empty!, though between the enter and leave it is 
not the case. What can you advice me to solve this problem?

Thanks
> Here is a hint that I've found, do not try to call gtk_init from one
> thread, then later run gtk_main in another. There is a context problem
> that will occur in glib, and no amount of gdk_thread_enter/leave will
> solve it. You can actually make it work, but it requires you to pass the
> context to the thread that needs it, which was more trouble that it was
> worth for my application, but some of you might run into this, so I
> thought I would mention it.
>
> On Thu, 2002-04-18 at 13:39, Michael Ivanov wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hallo!
> >
> > > > > I have problems creating a GUI and receive everytime this Message:
> > > > > Xlib: unexpected async reply (sequence 0x1686)!
> > > > >
> > > > > I have read in the internet it is due to threads that I am using in
> > > > > my programm.
> > > > > Can someone please help me solving this problem?
> > > >
> > > > See the Threads section in the FAQ:
> > > > http://www.gtk.org/faq/#AEN462
> >
> > I think I have the similar problem. Sometimes (not always) my application
> > hangs with the similar (unexpected async reply) diagnostics. The
> > application is multithreaded (actually only two threads, the second one
> > is, in general, non-gui, but occasionaly it outputs diagnostic messages
> > to the text widget.
> >
> > In my case the thread system is properly initialized, but the error
> > message still appears. The worst case is that I cannot reliably reproduce
> > the error and it occures very rarely.
> >
> > I think the faq entry, mentioned above, doesn't solve this specific
> > issue. Did anybody else had similar errors?
> >
> > Best regards
> > - --
> >  \   / |			           |
> >  (OvO) |  Michael Ivanov                   |
> >  (^^^) |      Voice:   +7 (812) 328-1907   |
> >   \^/  |      E-mail:  ivans@isle.spb.ru   |
> >   ^ ^  |                                   |
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.0.6 (GNU/Linux)
> > Comment: For info see http://www.gnupg.org
> >
> > iD8DBQE8vwTGL8uQSFsH2eMRAjIvAJ0V5tNIWk+//BWBORj+5ryd+7/EtgCgmgfo
> > qEHQLDQh7r1toJns0yorqWA=
> > =yMft
> > -----END PGP SIGNATURE-----
> >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
Eric Tchepannou



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