On the problem that VTK + QT process can’t end after closing the program

Settle the qt + VTK + ikt display dicom image problems, when writing the program found another more fatal problem, namely the end of the program, the master can’t quit, just window closes, test for a long time, found that can’t jump into a destructor after close the window or write their own close function, simply close the window.
I later on qt to intercept window’s close button events, method from http://sunshine1106.blog.51cto.com/1371108/305106/, the author summarizes the study reference, but even perform qApp – & gt; The exit (0), or qApp – & gt; The quit () or qApp – & gt; Functions such as closeAllWindows () still cannot terminate the main program process.
Then I define setAttribute(Qt:: wa_deleteonClose, true) at the beginning; It doesn’t do the trick.
Later I tried to delete the VTKImageView2 object I had defined for VTKSmartPoint by calling its own delete function fastDelete (), and when I ran it I found that the process had been deleted.
Although the goal has been achieved, but still feel strange, the previous online introduction said that the VTK SmartPoint class is able to automatically delete the pointer according to the program, memory resources release, I do not know why in my program it can not automatically release.
A description of the Delete and FastDelete functions in the SmartPoint class is as follows:

<span style="font-size:14px;">  // Description:
  // Delete a VTK object.  This method should always be used to delete
  // an object when the New() method was used to create it. Using the
  // C++ delete method will not work with reference counting.
  virtual void Delete();

  // Description:
  // Delete a reference to this object.  This version will not invoke
  // garbage collection and can potentially leak the object if it is
  // part of a reference loop.  Use this method only when it is known
  // that the object has another reference and would not be collected
  // if a full garbage collection check were done.
  virtual void FastDelete();</span>


Read More: