Xref: utzoo comp.windows.x:32541 comp.windows.open-look:564 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ncar!gatech!udel!princeton!siemens!dumbo!samaddar From: samaddar@demon.siemens.com (Sumitro Samaddar) Newsgroups: comp.windows.x,comp.windows.open-look Subject: Problem with fork and Xview Keywords: XPutImage is giving trouble Message-ID: Date: 8 Feb 91 22:32:27 GMT Sender: news@siemens.siemens.com Reply-To: samaddar@demon.siemens.com Followup-To: comp.windows.x Lines: 63 Summary: Using fork in Xview callback function. The child process is supposed to display an image array on an Xview canvas, using the Xlib call . It works the first time around, but causes an abnormal exit the next next around, with an error message about BadIDChoice. -------------------------------------------------------------------------- I am working on an Xview application with a canvas and a few buttons. The actions triggered by the buttons may potentially take a long time. Normally, when a button is clicked, the application is "blocked" till this action is completed. In order to be able to do some other interaction in the application, I want to run the actions as background processes. The way I went about was to in the callback function for a button (the one specified using PANEL_NOTIFY_PROC) and have the parent process return immediately. The child process actually executes the desired action and then exits. The data structure involved here includes a big image array. This array is defined as a static array in the file where all the callback functions have been defined. Is creating a child process inefficient here? Does it entail creating a copy of the whole image array? I have tried some simple image processing actions to be taken this way. It seems to work all right. However, if I try to DISPLAY using this way, I land into trouble. I use and to display the image. The first time around, there is no problem. However, the second time, I get an abnormal exit at the call, with the following error message : X Error: BadIDChoice Request Major code 55 () Request Minor code 6 ResourceID 0x1000037 Error Serial #789 Current Serial #782 I get different Error Serial # and Current Serial # every time, and they always differ with each other by 7. The parameter used for the Xlib calls (XCreateGC, XPutImage) is derived from the Xview canvas in the following manner : Canvas_pixwin = (Xv_window) xv_get(Main_panel->canvas, CANVAS_NTH_PAINT_WINDOW, 0); disp = (Display *) xv_get( Canvas_pixwin, XV_DISPLAY ); xwin = (Window) xv_get( Canvas_pixwin, XV_XID ); is the parameter, and is the parameter. I printed the value of this parameter just before the Xlib calls, and it is close but slightly different from the number. So far, I have seen the following value pairs : xwin 0xf0000e ResourceID 0xf00037 xwin 0x10000e ResourceID 0x100037 Any help in solving this problem will be appreciated. Sumitro