[vtkusers] vtkIdTypeArray GetValue segfault?

Bill Lorensen bill.lorensen at gmail.com
Mon Jun 7 16:56:46 EDT 2010


Your snippets look OK. perhaps you need to run with valgrind...

On Mon, Jun 7, 2010 at 4:34 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> I get an vtkIdTypeArray called "ids" like this:
> vtkIdTypeArray* ids;
> ids =
> vtkIdTypeArray::SafeDownCast(selectedGraph->GetVertexData()->GetArray("vtkIdFilter_Ids"));
> Then I check that it is valid:
> if(!ids)
>   break;
> Then I check that it has the correct number of tuples:
> std::cout << "ids has " << ids->GetNumberOfTuples() << " tuples." <<
> std::endl;
>
> Then I try to get a value from it:
>
>  for(vtkIdType i = 0; i < ids->GetNumberOfTuples(); i++)
>     {
>     vtkIdType id = ids->GetValue(i); //segfault occurs here
> but a segfault occurs where indicated above.
> Anyone know why this might happen? Or what other conditions to check before
> trying to access the data?
> 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