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

David Doria daviddoria+vtk at gmail.com
Fri Nov 6 07:51:39 EST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091106/ef3ee679/attachment.htm>


More information about the vtkusers mailing list