[vtkusers] Deleting unknown object: vtkObject - vector of pointers?
Bill Lorensen
bill.lorensen at gmail.com
Fri Nov 6 08:27:35 EST 2009
David,
Try printing the reference count of each LidarPoint before and after
std::cout << "Ref Before: " << LidarPoint->GetReferenceCount() << std::endl;
Column[phiCounter] = LidarPoint;
std::cout << "Ref After: " << LidarPoint->GetReferenceCount() << std::endl;
And outside the end of the inner loop:
std::cout << "Ref outside loop: " <<
OutputGrid[0]-.GetReferenceCount() << std::endl;
On Fri, Nov 6, 2009 at 7:51 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> I am trying to make a vector of vector of pointers to my class. When this
> small demo enters the inner loop for the second time, I get a whole bunch of
> "Deleting unknown object: vtkObject".
>
> Does anyone see a problem with this code? Or is there potentially a problem
> inside one of my vtkRay or vtkLidarPoint? I'm assuming something is
> happening when one of these is going out of scope since the errors occur on
> the loop entrance, but I don't see the problem with what is done here.
>
> #include "vtkLidarPoint.h"
> #include "vtkRay.h"
>
> #include "vtkSmartPointer.h"
>
> #include <vector>
>
> int main()
> {
>
> vtkstd::cout << "Deleting unknown object example2:" << vtkstd::endl;
>
> vtkstd::vector<vtkstd::vector<vtkLidarPoint*> > OutputGrid;
> OutputGrid.resize(10);
>
> for(unsigned int thetaCounter = 0; thetaCounter < 10; thetaCounter++)
> {
> vtkstd::vector<vtkLidarPoint*> Column;
> Column.clear();
> Column.resize(10);
>
> for(unsigned int phiCounter = 0; phiCounter < 10; phiCounter++) //THIS
> LINE
> {
> vtkSmartPointer<vtkRay> Ray = vtkSmartPointer<vtkRay>::New();
>
> vtkSmartPointer<vtkLidarPoint> LidarPoint =
> vtkSmartPointer<vtkLidarPoint>::New();
> LidarPoint->SetRay(Ray);
>
> Column[phiCounter] = LidarPoint;
>
> }
>
> OutputGrid[thetaCounter] = Column;
> }
>
> return 0;
> }
>
> Any comments?
>
> 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