Path: utzoo!attcan!uunet!decwrl!ucbvax!bloom-beacon!convex.UUCP!root From: root@convex.UUCP (Superuser) Newsgroups: comp.windows.x Subject: Lost mail for you Message-ID: <9006071734.AA16026@sushi> Date: 7 Jun 90 17:34:51 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 104 From pescadero.stanford.edu!expo.lcs.mit.edu!xpert-mailer Fri Jun 1 12:48:45 1990 remote from convex Received: by sushi (5.51/7.0) id AA02439; Fri, 1 Jun 90 12:48:45 CDT Received: by convex.COM (5.51/4.7) id AA06595; Fri, 1 Jun 90 12:48:39 CDT Received: from Erebus.Stanford.EDU by uxc.cso.uiuc.edu with SMTP (5.62+/IDA-1.2.8-900601) id AA22336 (for salevin%drlc1.UUCP@convex.com); Fri, 1 Jun 90 12:44:31 -0500 Received: from Hanauma.Stanford.EDU by erebus.Stanford.EDU with TCP; Fri, 1 Jun 90 10:48:40 PDT Received: by hanauma.stanford.edu (5.51/7.0) id AA17795; Fri, 1 Jun 90 10:44:20 PDT Received: from EXPO.LCS.MIT.EDU by Pescadero.Stanford.EDU (5.59/25-eef) id AA22777; Fri, 1 Jun 90 10:42:57 PDT Received: by expo.lcs.mit.edu; Fri, 1 Jun 90 10:09:44 EDT Received: from bloom-beacon.MIT.EDU by expo.lcs.mit.edu; Fri, 1 Jun 90 10:09:31 EDT Received: by bloom-beacon.MIT.EDU (5.61/25-eef) id AA15715; Fri, 1 Jun 90 09:56:25 EDT Received: from USENET by bloom-beacon.mit.edu with netnews for xpert@expo.lcs.mit.edu (xpert@expo.lcs.mit.edu) (contact usenet@bloom-beacon.mit.edu if you have questions) Date: 1 Jun 90 11:21:11 GMT From: convex!ames.arc.nasa.gov!yuki%ayumi%flab%fgw%titcca%ccut%sun-barr (Hiroyuki YOSHIDA) Organization: Fujitsu Laboratories Ltd., Kawasaki, Japan Subject: Parent Killer (Xt/X11R4 fix-10) Message-Id: Sender: convex!expo.lcs.mit.edu!xpert-request To: xpert@expo.lcs.mit.edu We coded a parent killer such as: /* ARGSUSED */ static void parentKiller(w,client_data,call_data) Widget w; caddr_t client_data; /* UNUSED */ caddr_t call_data; /* UNUSED */ { Widget papa = XtParent(w); int brothers = ((CompositeWidget)papa)->composite.num_children; if( brothers == 0 ) XtDestroyWidget(papa); } Then, attached the killer for widgets in a widgets tree using: XtAddCallback(w,XtNdestroyCallback,parentKiller,(caddr_t)NULL); This successfully worked before we patched fix-10 & -11. After fix-10/11, a server error occurs and the program exits. The error message is: X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 4 (X_DestroyWindow) Minor opcode of failed request: 0 Resource id in failed request: 0xb0039d Serial number of failed request: 4073 Current serial number in output stream: 4198 The resource id (0xb0039d) designates the child's window. We can avoid the error using work-proc technique, such as: /* ARGSUSED */ static void parentKiller(w,client_data,call_data) Widget w; caddr_t client_data; /* UNUSED */ caddr_t call_data; /* UNUSED */ { Widget papa = XtParent(w); int brothers = ((CompositeWidget)papa)->composite.num_children; if( brothers == 0 ) (void)XtAppAddWorkProc(app,XtDestroyWidget,(caddr_t)papa); /* Killing parent is postponed. */ } In addition, we can avoid the error by not applying a part of fix-10: *** /tmp/,RCSt1a03963 Thu Apr 19 19:44:53 1990 --- mit/lib/Xt/Destroy.c Thu Apr 19 19:44:55 1990 *************** *** 155,162 **** Recursive(widget, Phase2Destroy); app->in_phase2_destroy = outerInPhase2Destroy; ! /* popups destroy their own window if parent->being_destroyed */ ! if (window != NULL && (parent == NULL || !parent->core.being_destroyed)) XDestroyWindow(display, window); } /* XtPhase2Destroy */ --- 165,171 ---- Recursive(widget, Phase2Destroy); app->in_phase2_destroy = outerInPhase2Destroy; ! if (window) XDestroyWindow(display, window); } /* XtPhase2Destroy */ The problem may occur when the child's window is doubly destroyed in a very short time. Where is the BUG? In fix-10, server program, or our usage? -- Hiroyuki Yoshida yuki@flab.fujitsu.co.jp yuki%flab.fujitsu.co.jp@uunet.uu.NET