[vtk-developers] vtkSQLDatabase doesn't use SmartPointers

pat marion pat.marion at kitware.com
Wed Jun 2 19:17:43 EDT 2010


Sorry, maybe I am misunderstanding, but can't you can use this syntax:

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

Pat

On Wed, Jun 2, 2010 at 6:46 PM, David Thompson <dcthomp at sandia.gov> wrote:

> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100602/633f22bc/attachment.html>


More information about the vtk-developers mailing list