[vtk-developers] vtkSQLDatabase doesn't use SmartPointers

David Thompson dcthomp at sandia.gov
Wed Jun 2 18:46:49 EDT 2010


> In vtkSQLDatabase::CreateFromURL, there are lines like:
>     db = vtkMySQLDatabase::New(); //(line 430)
> This means you must manually clean up:...
>     db->Delete();
> By changing those lines to:
>    db = vtkSmartPointer<vtkMySQLDatabase>::New();
> could we then utilize smartpointer auto-cleanup?

I don't want to change the existing API; I have quite a bit of code  
that uses the database API as it is, which this change would break.  
I'm also not a fan of vtkSmartPointer as it makes debugging w/ gdb a  
real pain in the neck. The CreateFromURL() member works in the same  
way as vtkDataArray::CreateDataArray(), which also doesn't return a  
smart pointer. However, adding some *other* static member function  
that returned a smart pointer wouldn't necessarily be evil. Just don't  
do it without someone from Kitware blessing it -- I'm not an authority  
figure. :-)

	David





More information about the vtk-developers mailing list