[vtkusers] vtkGraph::AddVertex segfault
Caleb Johnston
cjj37 at cornell.edu
Thu May 13 15:15:35 EDT 2010
It is not a distributed graph. I have run the program numerous times in the
debugger and the problem definitely arrises from the AddVertex call.
My code is called at line 10, the AddVertex is at line 9.
0 ?? /lib/tls/i686/cmov/libc.so.6 0
0x0356ca22
1 malloc /lib/tls/i686/cmov/libc.so.6 0
0x0356e898
2 operator new(unsigned int) /usr/lib/libstdc++.so.6
0 0x034a9bb7
3
__gnu_cxx::new_allocator<vtkVertexAdjacencyList>::allocate(unsigned int,
void const*) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0
0x02f6a4b6
4 std::_Vector_base<vtkVertexAdjacencyList,
std::allocator<vtkVertexAdjacencyList> >::_M_allocate(unsigned int)
/usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f691f2
5 std::vector<vtkVertexAdjacencyList,
std::allocator<vtkVertexAdjacencyList>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<vtkVertexAdjacencyList*,
std::vector<vtkVertexAdjacencyList, std::allocator<vtkVertexAdjacencyList> >
>, vtkVertexAdjacencyList const&)
/usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f67341
6 std::vector<vtkVertexAdjacencyList,
std::allocator<vtkVertexAdjacencyList> >::push_back(vtkVertexAdjacencyList
const&) /usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0
0x02f65e5d
7 vtkGraph::AddVertexInternal(vtkVariantArray*, int*)
/usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02f63e3d
8 vtkMutableUndirectedGraph::AddVertex(vtkVariantArray*)
/usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02ff19a8
9 vtkMutableUndirectedGraph::AddVertex()
/usr/local/lib/vtk-5.4/libvtkFiltering.so.5.4 0 0x02ff1946
10 Model::loadVolumeData model.cxx 318
0x0813ffb7
11 Application::openFile application.cxx 96
0x0813b3aa
12 Application::qt_metacall moc_application.cxx 91
0x0815f9b5
13 QMetaObject::metacall qmetaobject.cpp 237
0x00bf4adb
14 QMetaObject::activate qobject.cpp 3285
0x00c025a7
15 QAction::triggered moc_qaction.cpp 263
0x0108f409
16 QAction::activate qaction.cpp 1255
0x01090acf
17 QMenuPrivate::activateCausedStack qmenu.cpp 1011
0x01568314
18 QMenuPrivate::activateAction qmenu.cpp 1103
0x0156f373
19 QMenu::mouseReleaseEvent qmenu.cpp 2312
0x0157169f
20 QWidget::event qwidget.cpp 7998 0x010fa39a
On Thu, May 13, 2010 at 2:30 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:
> And this is not a distributed graph?
>
> On Thu, May 13, 2010 at 2:16 PM, Caleb Johnston <cjj37 at cornell.edu> wrote:
>
>> I'm getting a segfault when calling vtkMutableUndirectedGraph::AddVertex.
>> However, it does not always occur at the same vertex. Sometimes it is after
>> the 2nd vertex. Sometimes it won't happen at all (though rarely). I'm only
>> adding about 120 vertices. And the program is not consuming large amounts of
>> data so I don't understand why this is happening. Also, this only happens in
>> Linux and Windows but not MacOS X. Below, I have included my algorithm for
>> adding vertices.
>>
>> thanks,
>> Caleb
>>
>> ...
>> int len = 0;
>> double X,Y,Z,Count;
>> for(i=0, j=0; j<numberOfLabels; i+=3, j++){
>> X = (double)coords[i];
>> Y = (double)coords[i+1];
>> Z = (double)coords[i+2];
>> Count = (double)centroids[j];
>> if(Count>0.0){
>> X = X / Count;
>> Y = Y / Count;
>> Z = Z / Count;
>> len++;
>> graph->AddVertex(); // crashes here.
>> graph->Update();
>> points->InsertNextPoint(X, Y, Z);
>> }
>> }
>> ...
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100513/a04c0f07/attachment.htm>
More information about the vtkusers
mailing list