Matthew.Diamond@MAPS.CS.CMU.EDU (03/06/90)
Here is what could be a simple problem (but I'm not sure). I have a piece of code which creates a unique name, then creates a form widget with that name. ... n = 0; XtSetArg(args[n], XtNheight, 10); n++; XtSetArg(args[n], XtNwidth, 10); n++; varWidget = XtCreateManagedWidget(uniquename, formWidgetClass, myboxwidget, args, n); ... The first time I do this everything works, I add some child widgets later and things are great. Then I unmanage varWidget and go back to create a new form widget, calling the same code (but the unique name is different). Once I've called XtCreateManagedWidget this second time, and not before, I'll get the following error when I enter an event loop: X Protocol error: not a valid window ID Major opcode of failed request: 8 (X_MapWindow) Minor opcode of failed request: 0 Resource id in failed request: 0x0 Serial number of failed request: 409 Current serial number in output stream: 411 The only difference I can think of between the first and second time this code is called is that the parent widget (myboxwidget) is not yet mapped the first time, but is the second time. That shouldn't make a difference... should it? This is running in R3, on a microVax with a 4-bit (monochrome) display. I welcome any suggestions, no matter how stupid they make me feel. Matthew Diamond matt@maps.cs.cmu.edu
liebman@xrxedds.UCP (03/07/90)
> Here is what could be a simple problem (but I'm not sure). > > I have a piece of code which creates a unique name, then creates a > form widget with that name. > ... > n = 0; > XtSetArg(args[n], XtNheight, 10); n++; > XtSetArg(args[n], XtNwidth, 10); n++; > varWidget = XtCreateManagedWidget(uniquename, formWidgetClass, myboxwidget, > args, n); > ... > > The first time I do this everything works, I add some child widgets later > and things are great. Then I unmanage varWidget and go back to create a new > form widget, calling the same code (but the unique name is different). > Once I've called XtCreateManagedWidget this second time, and not before, > I'll get the following error when I enter an event loop: > > X Protocol error: not a valid window ID > Major opcode of failed request: 8 (X_MapWindow) > Minor opcode of failed request: 0 > Resource id in failed request: 0x0 > Serial number of failed request: 409 > Current serial number in output stream: 411 > > The only difference I can think of between the first and second time this > code is called is that the parent widget (myboxwidget) is not yet mapped > the first time, but is the second time. That shouldn't make a difference... > should it? > > This is running in R3, on a microVax with a 4-bit (monochrome) display. > I welcome any suggestions, no matter how stupid they make me feel. > Matthew Diamond > matt@maps.cs.cmu.edu I have seen this too, here is a copy of the bug report and example. X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: Sun3 and Sun4 running SunOs4.0.3 DISPLAY TYPE: Sun CG6, CG4, CG2 WINDOW MANAGER: gwm, twm AREA: Xt SYNOPSIS: The widgets windows are being used before they are created. DESCRIPTION: Changeing the managed set of widgets by unmanaging one and then adding a new one causes protocol error. REPEAT BY: Compile and run appended program, wait 20 seconds and watch it die. SAMPLE FIX: Don'y have one, workaround: realize new widgets by hand before they are managed. Chris Liebman INTELNET: 8*440-2032 XNS: liebman:Herndon:xerox UUCP: ...!uunet!xrxedds!liebman ARPA: liebman.Herndon@Xerox.Com liebman@arisia.xerox.com ATT: 1-(703)-787-2032 ----------------------- bug.c --------------------------- #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Label.h> #include <X11/Xaw/Box.h> Widget TheTopLevel; Widget TheFrame; Widget TheFirstLabel; /* ARGSUSED */ static void MoreWidgets( id, data ) XtIntervalId id; caddr_t data; { (void) XtVaCreateManagedWidget("junk", labelWidgetClass, TheFrame, NULL); XtUnmanageChild(TheFirstLabel); (void) XtVaCreateManagedWidget("junk2", labelWidgetClass, TheFrame, NULL); } main(argc, argv) int argc; char *argv[]; { TheTopLevel = XtInitialize(argv[0], "XBug", NULL, 0, &argc, argv); TheFrame = XtVaCreateManagedWidget("frame", boxWidgetClass, TheTopLevel, NULL); TheFirstLabel = XtVaCreateManagedWidget("label1", labelWidgetClass, TheFrame, NULL); XtRealizeWidget(TheTopLevel); (void)XtAddTimeOut((unsigned long)20*1000, MoreWidgets, (caddr_t)NULL ); XtMainLoop(); } -- Chris Liebman INTELNET: 8*440-2032 XNS: liebman:Herndon:xerox UUCP: ...!uunet!xrxedds!liebman ARPA: liebman.Herndon@Xerox.Com liebman@arisia.xerox.com ATT: 1-(703)-787-2032