[vtkusers] Deleting unknown object: vtkObject - vector of pointers?
David Doria
daviddoria+vtk at gmail.com
Tue Nov 10 14:25:24 EST 2009
On Fri, Nov 6, 2009 at 12:26 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
> Ray is not initialized in the constructor. Do a
> Ray=NULL;
>
> Don't forget to Delete() Ray in the destructor.
>
Getting closer... it gets to the end of the program now without crashing,
errors, or warnings - but when the program quits (I put a break point on the
'return 0' statement and the following errors happen when I step over return
0) I get "Deleting unknown object" errors. I'm assuming I am misinterpreting
the reference count that happens when the objects get added to the stl
container and when the container goes out of scope? Should the stl vector(s)
be of smartpointers or standard pointers?
I added the following line at the end of the outer loop:
vtkstd::cout << "Ref after column added to grid: " <<
Grid[0][0]->GetReferenceCount() << vtkstd::endl;
The reference count is still 2... is this what we would expect? Shouldn't it
be 3 here? Because then when the program terminates, the outer vector (1)
deletes the inner vectors(2) which delete the LidarPoints (3) so the count
should have been 3 to then go down to 0?
Here is the current version:
http://rpi.edu/~doriad/VTK_List/DeletingUnknownObject/ (there are too many
files to post the code directly to the list).
One day we'll get this resolved... haha.
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091110/4d1b753e/attachment.htm>
More information about the vtkusers
mailing list