[vtk-developers] vtkSQLDatabase doesn't use SmartPointers

David Doria daviddoria+vtk at gmail.com
Wed Jun 2 18:09:14 EDT 2010


In vtkSQLDatabase::CreateFromURL, there are lines like:

    db = vtkMySQLDatabase::New(); //(line 430)

This means you must manually clean up:

vtkMySQLDatabase* db = vtkMySQLDatabase::SafeDownCast(
          vtkSQLDatabase::CreateFromURL(
"mysql://root@localhost/TestDatabase" ) );
db->Delete();

By changing those lines to:

    db = vtkSmartPointer<vtkMySQLDatabase>::New();

could we then utilize smartpointer auto-cleanup?

vtkSmartPointer<vtkMySQLDatabase> db = vtkMySQLDatabase::SafeDownCast(
          vtkSQLDatabase::CreateFromURL(
"mysql://root@localhost/TestDatabase" ) );

Thanks,

David



More information about the vtk-developers mailing list