[vtkusers] Reference Counting and Delete()

Samuel Barnes ironictoo at yahoo.com
Wed May 17 11:19:57 EDT 2006


I have ran into a new problem switching from vtk 4.x to 5.0.  When I try to delete something that has been used in the pipeline indirectly without increasing its reference count (a DeepCopy for example) it causes a vtk error "vtk Object (0x..): Destructing!" and then crashes.  For example:

vtkImageData* newimage = vtkImageData::New();

vtkStructuredPointsReader* reader = vtkStructuredPointsReader::New();
    reader->SetFileName(datPath);
newimage = reader->GetOutput();

vtkImageData* tryit = vtkImageData::New();
    tryit->DeepCopy(newimage);
    tryit->Update();
newimage->Delete();

Causes the above error and crash.  I am aware that this is a nonsense case, I am not actually doing this in my pipeline, this is just a simplified example of the crash.  Is this a vtk bug or should I be doing something different? Thanks.  Oh I am using vtk 5.0.0 on windows xp home with VC++ 6.0.

Samuel Barnes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060517/f3ea8147/attachment.htm>


More information about the vtkusers mailing list