Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: fork() and BadIDChoice Message-ID: <9103060732.AA02341@lightning.McRCIM.McGill.EDU> Date: 6 Mar 91 07:32:34 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 26 > I'm writing a Motif application which requires me to fork() and > continue processing with the same windows & environment. The first > time I try to bring up a new window after the fork(), I get the > following error: > X Error of failed request: BadIDChoice (invalid resource ID chosen for this connection) [...] > I think that I have to create a new connection to the original > display... but I don't know how to do that. (This is the deepest > I've had to delve into Xlib.) You are correct. When a process with an X connection open fork()s, at most one of the resulting two processes can do anything to the connection (where XCloseDisplay counts as doing something). One of the processes should probably close the connection out from under Xlib, with close(XConnectionNumber(dpy)), and *then* XCloseDisplay() (to free up the Xlib data structures) and open a new connection. How this relates to toolkits and higher layers I have no idea. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu