Bug 33851 - destructors of Toplevelwidgets of KDevelop creted Applications are not called on exit
Summary: destructors of Toplevelwidgets of KDevelop creted Applications are not called...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kdevelop
Classification: Applications
Component: kdevelop 2.x (obsolete) (show other bugs)
Version: 2.0.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop-Devel List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-18 09:48 UTC by O Dreyer
Modified: 2002-10-10 20:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O Dreyer 2001-10-18 09:35:16 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdevelop
Version:           2.0.1 (using KDE 2.2.1 )
Severity:          normal
Installed from:    SuSE
Compiler:          gcc version 2.95.3 20010315 (SuSE)
OS:                Linux (i686) release 2.4.7-4GB
OS/Compiler notes: 

In the main-function of a wizard-generated application you can find the line

return a.exec();

This means:
After leaving the main loop of the app the program will return directly  and calls not the destructor of the toplevel widget.

Please change this similar like this:

int main(int argc char *argv[])
{
  int ret;

  KAboutData aboutData( "kvncserver" I18N_NOOP("KVNCServer")
    VERSION description KAboutData::License_GPL
    "(c) 2001 Olaf Dreyer" 0 0 "o.dreyer@mwi-online.de");
  aboutData.addAuthor("Olaf Dreyer"0 "o.dreyer@mwi-online.de");
  KCmdLineArgs::init( argc argv &aboutData );
  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

  KApplication a;
  KVNCServer *kvncserver = new KVNCServer();
  a.setMainWidget(kvncserver);

  ret = a.exec();

  delete kvncserver;

  return ret;
}


(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Caleb Tennis 2002-10-10 20:04:08 UTC
I recommend, instead, doing this: 
 
KVNCServer kvncserver; 
a.setMainWidget(&kvncserver); 
return a.exec(); 
 
} 
 
now it will get deleted because it's on the stack and not on the heap.