sxb@sequoia.cray.com (Stephen Behling) (03/01/91)
I am just starting my Motif programming after a few years playing around with Xlib. I am finding it a lot of fun, but a bug I have is causing me pain. I've tried everything I can think of for a couple days now...and now I need help. I get a segmentation fault core dump when I try to use a WarningDialog from a widget, but only if I first use a WarningDialog from a second widget. SITUATION: I create a Form widget in an application shell. In the Form I create a MenuBar and a DrawingArea. In the MenuBar I create six CascadeButtons with PullDownMenus that have some PushButtons. All this works, and the Callbacks are fine. Now I am starting to add dialog widgets to the PushButtons. On one PushButton I create a FileSelectionDialog and on another, I create a SelectionDialog. For each of these Dialogs, I set the mustMatch parameter to True and add a noMatchCallback. In the noMatchCallback, I create a WarningDialog with just the OK button (by unmanaging the others). The following causes the bug: PushButton to create SelectionDialog. Have bad selection so noMatchCallback is called Create the WarningDialog Click OK on the WarningDialog Either make good selection or cancel. (Call XtDestroyWidget for WarningDialog widget and then the SelectionDialog in either case). PushButton to create FileSelectionDialog Have bad selection so noMatchCallback is called (this is a different nomatch callback) Create the WarningDialog ...here I get.... Warning: null child passed to XtManageChildren Segmentation fault (core dumped) I can do it slightly differently and get... Warning: no ext to pop Segmentation fault (core dumped) -------- -------- Anybody have any ideas yet? Remember, I'm brand new to -------- Motif, so I may be doing something obviously dumb -------- SYSTEM: Sun sparc 4.1-GFX- with Motif 1.1 THE CODE FRAGMENTS ARE: To create the FileSelectionDialog...... n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, MENU_BAR_HEIGHT + 4); n++; XtSetArg(args[n], XmNmustMatch, True); n++; XtSetArg(args[n], XmNapplyLabelString, XmStringCreateLtoR("Apply Filter", XmSTRING_DEFAULT_CHARSET)); n++; XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++; file_box = XmCreateFileSelectionDialog(main_window, "File Select", args, n); tmp_widget = XmFileSelectionBoxGetChild(file_box, XmDIALOG_HELP_BUTTON); XtUnmanageChild(tmp_widget); XtAddCallback(file_box, XmNcancelCallback,Cancel3CB,NULL); XtAddCallback(file_box, XmNokCallback,OpenOKCB,NULL); XtAddCallback(file_box, XmNnoMatchCallback,NomatchOpenCB,NULL); XtManageChild(file_box); and for the SelectionDialog.... n = 0; XtSetArg(args[n], XmNlistItems, item); n++; XtSetArg(args[n], XmNlistItemCount, m); n++; XtSetArg(args[n], XmNlistVisibleItemCount, 15); n++; XtSetArg(args[n], XmNmustMatch, True); n++; XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++; XtSetArg(args[n], XmNautoUnmanage, False); n++; my_widget = XmCreateSelectionDialog( main_window, "ChooseContour", args, n); tmp_widget = XmSelectionBoxGetChild(my_widget, XmDIALOG_HELP_BUTTON); XtUnmanageChild(tmp_widget); tmp_widget = XmSelectionBoxGetChild(my_widget, XmDIALOG_APPLY_BUTTON); XtUnmanageChild(tmp_widget); XtAddCallback(my_widget, XmNcancelCallback,Cancel2CB,NULL); XtAddCallback(my_widget, XmNokCallback,ConOKCB,NULL); XtAddCallback(my_widget, XmNnoMatchCallback,NomatchChooseConCB,NULL); XtManageChild(my_widget); USING DBX I GET: (from the Warning: no ext to pop case...) Reading symbolic information... Read 2603 symbols program terminated by signal SEGV (no mapping at the fault address) (dbx) where _XmPopWidgetExtData() at 0x779dc `PushBG`SetValuesPosthook() at 0x868d4 SetValuesLeafWrapper() at 0x784f8 CallConstraintSetValues() at 0xf7718268 XtSetValues() at 0xf77184ac _XmBulletinBoardSetDynDefaultButton() at 0x7d5a4 _XmBulletinBoardFocusMoved() at 0x7cee8 _XmFileSelectionBoxFocusMoved() at 0xca38 _XtCallCallbacks() at 0xf7700998 XtCallCallbackList() at 0xf7700c04 _XmCallFocusMoved() at 0x71170 _XmTrackShellFocus() at 0x710c0 DispatchEvent() at 0xf7708ee8 DecideToDispatch() at 0xf7709520 XtDispatchEvent() at 0xf77096d8 XtAppMainLoop() at 0xf77099d4 main() at 0x23a4 I may not look at this news group for a week, and our news service only keeps 3 days worth. So if you think you know a fix, please e-mail it to me at sxb@dione.cray.com