[vtkusers] vtkSmartPointer BUG

pjtr hahn pjtr.hahn at googlemail.com
Tue Oct 7 10:58:01 EDT 2008


Hmm, Ok I didn't knew the usage you show in your example but
netherless the docs have an assignment operator that should work as I
expected, or am I wrong?

vtkSmartPointer & operator= (T *r)


Thanks so far for your hint and example.



2008/10/7 David Cole <david.cole at kitware.com>:
> I am not sure why that worked before...... It should have given you a memory
> leak before. Maybe you didn't really have leak detection turned on before?
> The correct New construct to use with vtkSmartPointer is:
>   vtkSmartPointer<vtkSomeObject> ptr
> = vtkSmartPointer<vtkSomeObject>::New();
> HTH,
> David
>
> On Tue, Oct 7, 2008 at 9:39 AM, pjtr hahn <pjtr.hahn at googlemail.com> wrote:
>>
>> Hello,
>>
>> since my last CVS Update (today)  vtkSmartPointer isn't working like
>> expected anymore.
>>
>> While code like
>>
>> function_scope{
>>
>> vtkSomeObject * ptr = vtkSomeObjekt::New();
>>
>> ...... more code ......
>>
>> ptr->Delete();
>>
>> }
>>
>> works I get memory leak error messages when changing the same code to
>>
>> function_scope{
>>
>> vtkSmartPointer< vtkSomeObject > ptr = vtkSomeObjekt::New();
>>
>> ...... more code ......
>>
>> } // end scope
>>
>> This worked before.
>>
>> I'm on Vista / Visual Studio Express 2008
>>
>> regards,
>>
>> Peter
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list