From: Alan W. I. <Ala...@gm...> - 2018-12-31 19:44:57
|
On 2018-12-31 11:28-0800 Alan W. Irwin wrote: > [...] by the following temporary changes to > qt_example: > > argc = 1; > QApplication a( argc, argv ); > // Must construct an instance of PlotWindow after QApplication. > PlotWindow * win = new PlotWindow( Argc, Argv ); > > // Clean up Argv now that we are done with processing arguments. > for ( int i = 0; i < Argc; ++i ) > { > delete[] Argv[i]; > } > delete[] Argv; > > delete win; > return 0; > > So the QApplication never gets explicitly used in this experimental > version of the code whose job is simply to test the PlotWindow > constructor and destructor without actually using the PlotWindow > instance for anything. An additional important part of these > experiments is to make some changes to the destructor such as calling > plend from there. And now I am going to test the effect of the > Qt::WA_DeleteOnClose attribute as well. P.S. Something that just struck me is the above experimental code and also the normal version of this code create the "a" instance of QApplication on the stack. So that instance should automatically be deleted when the above code or the non-experimental version of this code return from qt_example main routine. So setting the above attribute seems like overkill and, in fact, might cause a double free. So at this stage I am hoping that not setting this attribute (as you tried in your own experiment) is the key step required in fixing the qt_example memory management. More later. Alan __________________________ Alan W. Irwin Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |