[comp.windows.x] Multiple Initialization of a Composite Widget

rogerska@eplrx7.uucp (Allen Rogers) (09/27/90)

I have a program that creates a composite widget with XtAppInitialize.
When the user presses the quit button, I use XtDestroyApplicationContext 
to destroy the composite widget but the program does not exit.  Instead the 
program recreates the same composite widget with XtAppInitialize:

  forever
  {
	toplevel=XtAppInitialize();
	...
	do
	{
	  XtMainLoop();
	  ...
	}
	while (not quit);
	XtDestroyApplicationContext();
  }

The first time I create and destroy the widget everything works correctly. 
The second time I create the widget I get the following warnings:

  Warning: Initializing Resource Lists twice
  Warning: Intializing Translation manager twice

When I destroy it again I get a bad free:

  free: block 0x788d58 was already free

and the program crashes.

I have tried replacing the XtDestroyApplicationContext with an XtCloseDisplay 
without success. It appears that since I am not exiting the main program some 
Xt resources aren't getting cleared.

Does anyone have any insight or suggestions???

Thanks in advance,

Allen Rogers
rogerska%esvax@dupont.com
--
The UUCP Mailer