Path: utzoo!utgpu!mnetor!charles From: charles@mnetor.UUCP (Charles Stoner) Newsgroups: comp.windows.x.motif Subject: problems creating and destroy app shells Message-ID: <5613@mnetor.UUCP> Date: 30 Nov 90 21:32:46 GMT Reply-To: charles@mnetor.UUCP (Charles Stoner) Organization: Motorola Technical Systems Division, Toronto Design Centre Lines: 57 I am having trouble creating (and destroying) application shells. The code below is a distilled version of the original source so while it may not do anything useful, all lines have a purpose. The code should produce a topLevelShell containing one button, that when hit will manage and unmanage a prompt dialog and also create and destroy an application shell. The prompt dialog is created once and attached to the button while the application shell is created and destroyed dynamically. When the button in the main app shell is hit a few times the program will crash. All lines seem to be necessary to generate a memory fault, even keeping the prompt dialog modal. I have tried the dynamic shell as both a topLevelShell and a transientShell. Other than transientShells being iconified when the client is iconified, is there a difference? I am using X11R4 and Motif 1.1 and compiling with gcc 1.35 and Motorla UNIX sys V 3.0. Am I missing the obvious? Any feedback would be appreciated. Thanks in advance - Chuck. /*--------------------- cut here -------------------------*/ #include #include #include #include #include #include static Widget prompt; static void subshell(Widget w,XtPointer client_data,XtPointer call_data) { Widget shell = XtCreateApplicationShell("shell", transientShellWidgetClass,NULL,0); XtDestroyWidget(shell); XtManageChild(prompt); XtUnmanageChild(prompt); } void main(int argc,char **argv) { Widget shell; Widget button; Arg arg; shell = XtInitialize("shell","Shell",NULL,0,(Cardinal *) &argc,argv); XtManageChild(button = XmCreatePushButton(shell,"button",NULL,0)); XtAddCallback(button,XmNactivateCallback,subshell,NULL); XtSetArg(arg,XmNdialogStyle,XmDIALOG_APPLICATION_MODAL); prompt = XmCreatePromptDialog(button,"prompt",&arg,1); XtRealizeWidget(shell); XtMainLoop(); }