[vtkusers] Deleting unknown object: vtkObject - vector of pointers?

Bill Lorensen bill.lorensen at gmail.com
Tue Nov 10 15:20:42 EST 2009


I a ref of 2 is correct. The Grid[i]=Column should have no ref count
implication since Column is a vector.

BTW, the current code does not crash on my system.

Bill

On Tue, Nov 10, 2009 at 2:25 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK 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