From: srit Date: Fri, 1 Apr 2011 08:51:47 +0000 (+0000) Subject: Remove leaks related to vvImageWriter X-Git-Tag: v1.2.0~76 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=dd5f76100aae9f0a2dc7163327163ffceb37b07e;p=clitk.git Remove leaks related to vvImageWriter --- diff --git a/vv/vvImageWriter.h b/vv/vvImageWriter.h index e9a9c38..3effb47 100644 --- a/vv/vvImageWriter.h +++ b/vv/vvImageWriter.h @@ -24,12 +24,12 @@ #include "itkCommand.h" #include "vvImage.h" -class vvImageWriter { +class vvImageWriter : public itk::LightObject { public: - // constructor - vvImageWriter(); - ~vvImageWriter(); + typedef vvImageWriter Self; + typedef itk::SmartPointer Pointer; + itkNewMacro(Self); void SetOutputFileName(std::string filename); void SetObserver(itk::Command::Pointer o) { @@ -56,6 +56,10 @@ public: void Update(int dim, std::string OutputPixelType); protected: + // constructor + vvImageWriter(); + ~vvImageWriter(); + //==================================================================== std::string mOutputFilename; itk::Command::Pointer mObserver; diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 760fa75..885201b 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -2193,7 +2193,7 @@ void vvMainWindow::SaveAs() std::string action = "Saving"; vvProgressDialog progress("Saving "+fileName.toStdString()); qApp->processEvents(); - vvImageWriter *writer = new vvImageWriter; + vvImageWriter::Pointer writer = vvImageWriter::New(); writer->SetOutputFileName(fileName.toStdString()); writer->SetInput(mSlicerManagers[index]->GetImage()); writer->Update();