Re: XForms: XForms/fork()/events

Peter Tobias (tobias@et-inf.fho-emden.de)
Thu, 3 Jul 1997 02:22:06 +0200

To subscribers of the xforms list from Peter Tobias <tobias@et-inf.fho-emden.de> :

On Jul 2, Steve Lamont wrote:
> > This works fine when I don't use the fork. But I can't use this form and
> > the main form (and the other forms) at the same time. When I use fork to
> > create a new process which should handle the "send signals" form the program
> > dies with an "Xlib: unexpected async reply (sequence 0x879)!" (the number
> > changes).
>
> One possibility is that when the child process dies or closes down, it
> is closing down the X connection to the server, which then causes Xlib
> in the parent to get massively confused since it gets a message from
> the server that really should be destined for the child (or, to be
> completely correct, never sent at all).
>
> What you need to do is to shut down the X connection on the child
> process so that when it goes away it doesn't try to communicate with
> the server. Do this by getting the connection number (the file
> descriptor under Unix) and issuing a close. Here's a little bit of
> test code I whomped up that does this:

With this change the "Xlib: unexpected async ..." message doesn't appear
anymore but I now get a different error.

XIO: fatal IO error 2 (Bad file number) on X server ":0.0"
after 1993 requests (1992 known processed) with 0 events remaining.

Remember that the first things the child process does are to create a new
form and to wait for the user to press a button. With the X connection
closed the XForms commands probably won't work :-).

BTW: the "Xlib: ..." message appeared before the first form of the process
was shown (not after the process died).

Thanks,

Peter

-- 
Peter Tobias <tobias@et-inf.fho-emden.de> <tobias@debian.org> <tobias@linux.de>
PGP ID EFAA400D, fingerprint = 06 89 EB 2E 01 7C B4 02  04 62 89 6C 2F DD F1 3C 
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/