User talk:ScratchMonkey

From KitwarePublic
Revision as of 02:00, 18 February 2010 by Daviddoria (talk | contribs)
Jump to navigationJump to search

I have a SmartPointer question for you (since you clearly know what is going on - thanks for adding to the tutorial!), but I'm not sure who you are! Can you send me your email address?

daviddoria 00:50, 18 February 2010 (UTC)

I am trying to use a smart pointer for a member variable in this example: http://www.vtk.org/Wiki/VTK/Examples/RectangularButtonSource

In the MouseInteractorStyle class, I have:

<source lang="cpp">

   void SetRenderWindow(vtkSmartPointer<vtkRenderWindow> renderWindow) {this->RenderWindow = renderWindow;}
   //void SetRenderWindow(vtkRenderWindow* renderWindow) {this->RenderWindow = renderWindow;}
 private:
   vtkSmartPointer<vtkRenderWindow> RenderWindow;
   //vtkRenderWindow* RenderWindow;

</source>

If I use the smart pointer lines above (uncommented), debug leaks produces lots of messages. If I used the commented lines (non-smart pointer), it works fine. My thought was that in main, I have a vtkSmartPointer<vtkRenderWindow>, so I should continue to pass it around and store it as a smart pointer instead of a normal pointer. Is that not the correct thing to do?

Please take a look and let me know what you think.

Thanks! daviddoria 02:00, 18 February 2010 (UTC)