Browse Source

Fixed double delete

Benoit Bleuze 14 years ago
parent
commit
8d1cd66275

+ 3 - 1
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -53,7 +53,9 @@ ctkHostAppExampleWidget::ctkHostAppExampleWidget(QWidget *parent) :
 ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
 {
   delete this->Host;
-  delete ui;
+  this->Host = 0;
+  delete this->ui;
+  this->ui = 0;
 }
 
 //----------------------------------------------------------------------------

+ 2 - 1
Plugins/org.commontk.dah.app/ctkDicomAppPlugin.cpp

@@ -44,7 +44,6 @@ ctkDicomAppPlugin::ctkDicomAppPlugin()
 //----------------------------------------------------------------------------
 ctkDicomAppPlugin::~ctkDicomAppPlugin()
 {
-  std::cout<<"in the destructor of the plugin"<<std::endl;
   delete this->AppServer;
   delete this->HostInterface;
   ctkDicomAppPlugin::Context = 0;
@@ -83,6 +82,8 @@ void ctkDicomAppPlugin::stop(ctkPluginContext* context)
 
   delete this->AppServer;
   delete this->HostInterface;
+  this->AppServer = 0;
+  this->HostInterface = 0;
   this->Context = 0;
 }
 

+ 1 - 0
Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin.cpp

@@ -41,6 +41,7 @@ ctkExampleDicomAppPlugin::~ctkExampleDicomAppPlugin()
 {
   qDebug()<< "delete applogic";
   delete this->AppLogic;
+  this->AppLogic = 0;
 }
 
 //----------------------------------------------------------------------------

+ 4 - 1
Plugins/org.commontk.dah.host/ctkDicomAbstractHost.cpp

@@ -62,7 +62,10 @@ ctkDicomAbstractHostPrivate::ctkDicomAbstractHostPrivate(
 ctkDicomAbstractHostPrivate::~ctkDicomAbstractHostPrivate()
 {
   delete this->Server;
-  delete this->AppService;
+  this->Server = 0;
+  //do not delete AppService, deleted somewhere else before?
+  //delete  this->AppService;
+  //this->AppService = 0;
 }
 
 //----------------------------------------------------------------------------