Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!bellcore!wind!dfs From: dfs@wind.bellcore.com (Deborah Swayne) Newsgroups: comp.windows.x Subject: Returning from an X application program Keywords: Initialization Message-ID: <15874@bellcore.bellcore.com> Date: 3 May 89 19:17:28 GMT Sender: news@bellcore.bellcore.com Reply-To: dfs@bellcore.com (Debby Swayne) Distribution: usa Organization: Bellcore, Morristown, NJ Lines: 47 I'm calling an X application program from inside S, an interactive statistics program. I am using a combination of Toolkit programs, widgets, and Xlib calls. I'm doing fine with the startup, but I'm having trouble stopping. I need to return rather than exiting, but I would like to shut down the entire X program, and I can't figure out how. (This is inarticulate, I know -- I don't really know how to say what I want to say.) To start up, I'm using XtToolkitInitialize(); display = XtOpenDisplay((XtAppContext) NULL, (String) NULL, argvv[0], "", (XrmOptionDescRec *) NULL, (Cardinal) 0, &argcc, argvv); scrn = DefaultScreenOfDisplay(display); i = 0; XtSetArg(args[i], XtNscreen, scrn); i++; XtSetArg(args[i], XtNargc, argcc); i++; XtSetArg(args[i], XtNargv, argvv); i++; shell = XtAppCreateShell(argvv[0], "", applicationShellWidgetClass, display, args, (Cardinal) i); and then defining all the widgets and callbacks, setting up the GC, and realizing the shell. To shut down, I'm experimenting with XtDestroyApplicationContext(XtWidgetToApplicationContext(shell)); XtDestroyWidget(shell); XtFree(argvv); return(0); Well, this leaves ok, but what if I want to restart the application during the same S session? Then I get this: X Toolkit Warning: Initializing Resource Lists twice X Toolkit Warning: Intializing Translation manager twice. System terminating: bad address So what should I do here? Can I un-initialize the Resource Lists and the Translation manager? Or should I keep track of a static variable and not perform the Toolkit initialization more than once? How are other people managing this procedure? The documentation is just confusing me ... Debby Swayne dfs@bellcore.com