Sorry, maybe I am misunderstanding, but can't you can use this syntax:<br><br>vtkSmartPointer<vtkMySQLDatabase> db =<br> vtkSmartPointer<vtkMySQLDatabase>::Take(vtkMySQLDatabase::SafeDownCast(<br> vtkSQLDatabase::CreateFromURL("mysql://root@localhost/TestDatabase")));<br>
<br>Pat<br><br><div class="gmail_quote">On Wed, Jun 2, 2010 at 6:46 PM, David Thompson <span dir="ltr"><<a href="mailto:dcthomp@sandia.gov">dcthomp@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
In vtkSQLDatabase::CreateFromURL, there are lines like:<br>
db = vtkMySQLDatabase::New(); //(line 430)<br></div>
This means you must manually clean up:...<div class="im"><br>
db->Delete();<br>
By changing those lines to:<br>
db = vtkSmartPointer<vtkMySQLDatabase>::New();<br>
could we then utilize smartpointer auto-cleanup?<br>
</div></blockquote>
<br>
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. :-)<div>
<div></div><div class="h5"><br>
<br>
David<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br>