[comp.windows.x] DEC Windows Server crash in Scroll Window ?

schiebel@cs.wvu.wvnet.edu (Darrell Schiebel) (12/11/90)

We are having a problem with the X server crashing.  The problem occurs when we
have a scroll window widget and then try to have a popup menu within that
widget (or having an option menu "overlap" the scroll window widget).  The
result is a server crash.  We are running version 4.0 of the workstation
software on a DECstation 3100 with 16 Meg of memory.  A listing of code that
causes the crash follows at the end of this posting.

This is what we "think" is happening.  We would like to have this confirmed and
any possible workarounds would be greatly appreciated.  The problem appears to
be that the window widget is too big.  The widget (or the underlying X window)
keeps a "backup" of the window contents and when the window is too big not
enough contiguous memory can be allocated.  When the popup menu occurs (or an
option menu overlaps), the widget will try to save the portion of the window
that the window covers, this for subsequently restoring the contents of the
window.  Since the window was too big there was no memory allocated for its
backup contents, therefore the crash occurs.

Does this sound reasonable????  Is there another explanation????  Is there a
fix or workaround??????

Any suggestions and/or comments would be greatly appreciated.  Thanks in
advance.

Below is the information from dbx:

      : dbx /usr/bin/dxsession core
      dbx version 2.0
      Type 'help' for help.
      Corefile produced from file "Xcfb"
      Child died at pc 0x5846c0 of signal : Illegal instruction
      reading symbolic information ...
      [using memory image in core]
      (dbx) where
      >  0 Help_Widget.SetValues(
      data address 0x7fffc03c too high (ub = 0x7fffc000)
      (dbx)


The following is the code that produces the crash (Bringing up the popup
menu crashes the server on our system):

-------------------------------------------------------------------------------


#include <stdio.h>
#include <X11/DwtAppl.h>
char *items[64] = { "item1","item2","item3","item4","item5",
    "longitem1","longitem2","longitem3","longitem4","longitem5"};
main(argc, argv)
     int argc;
     char **argv;
{
  Widget toplevel, mainwin, topwin, pdmenu, item, choice, popup, scroll, plane;
  Arg arglist[10];
  int argcount, i;
  int plane_ht, plane_width;
  DwtCompString string;

  /* Initialize X. */
  toplevel = XtInitialize("TEST", "testclass", NULL, 0, &argc, argv);

  /* Create the main window widget. */
  argcount = 0;
  XtSetArg(arglist[argcount], DwtNacceptFocus, TRUE); argcount++;
  XtSetArg(arglist[argcount], DwtNwidth, 500); argcount++;
  XtSetArg(arglist[argcount], DwtNheight, 500); argcount++;
  mainwin = DwtMainWindowCreate(toplevel, "MAINWINDOW", arglist, argcount);

  /* Create a topwindow window. */
  topwin = DwtDialogBoxCreate(mainwin, "TOPWINDOW", NULL, 0);

  /* Create choicewin. */
  pdmenu = DwtMenu(topwin, "pdmenu", 0, 0, DwtMenuPulldown,
                 DwtOrientationVertical, NULL, NULL, NULL);

  for (i=0; i<3; i++) {
    string = DwtLatin1String(items[i]);
    XtSetArg(arglist[0], DwtNx, 0);
    XtSetArg(arglist[1], DwtNy, 0);
    XtSetArg(arglist[2], DwtNlabel, string);
    item = DwtPushButtonCreate(pdmenu, "choice_item", arglist, 3);
    XtManageChild(item);
  }

  string = DwtLatin1String("choice window:");
  argcount=0;
  XtSetArg(arglist[argcount], DwtNx, 10); argcount++;
  XtSetArg(arglist[argcount], DwtNy, 10); argcount++;
  XtSetArg(arglist[argcount], DwtNlabel,string); argcount++;
  XtSetArg(arglist[argcount], DwtNsubMenuId, pdmenu); argcount++;
  choice = DwtOptionMenuCreate(topwin, "choice_window", arglist, argcount);
  XtManageChild(choice);

  /* Create the scroll widget. */
  scroll = DwtScrollWindow(topwin, "Scroll Widget", 50, 50, 300, 300);

  /* Create the plane widget. */
  plane_ht = 15000;
  plane_width = 15000;
  plane = DwtWindow(scroll, "Plane Widget", 0, 0, plane_ht, plane_width, NULL);

  XtManageChild(mainwin);
  XtManageChild(topwin);
  XtManageChild(scroll);
  XtManageChild(plane);

  XtRealizeWidget(toplevel);
  XtMainLoop();
} /* end of main */