]> Creatis software - clitk.git/commitdiff
Remove leaks related to vvImageWriter
authorsrit <srit>
Fri, 1 Apr 2011 08:51:47 +0000 (08:51 +0000)
committersrit <srit>
Fri, 1 Apr 2011 08:51:47 +0000 (08:51 +0000)
vv/vvImageWriter.h
vv/vvMainWindow.cxx

index e9a9c3825f6837c4f7a5ee17c45736bee1faab0e..3effb474235fe19c48ee7f25c14fd358ee182431 100644 (file)
 #include "itkCommand.h"
 #include "vvImage.h"
 
-class vvImageWriter {
+class vvImageWriter : public itk::LightObject {
 
 public:
-  // constructor
-  vvImageWriter();
-  ~vvImageWriter();
+  typedef vvImageWriter Self;
+  typedef itk::SmartPointer<Self> 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;
index 760fa758558712aa798d07847b614a2ffd5f569f..885201ba6572ea8c15c39840c1937cf1892b76ff 100644 (file)
@@ -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();