0001019: Crash on document recompute

This commit is contained in:
wmayer 2013-03-03 12:24:44 +01:00
parent 3025c6e292
commit 18355cdd25

View File

@ -1090,23 +1090,24 @@ std::vector<App::DocumentObject*> Document::getInList(const DocumentObject* me)
return result; return result;
} }
void Document::_rebuildDependencyList(void)
void Document::_rebuildDependencyList(void){ {
d->VertexObjectList.clear();
d->DepList.clear();
// Filling up the adjacency List // Filling up the adjacency List
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
// add the object as Vertex and remember the index // add the object as Vertex and remember the index
d->VertexObjectList[It->second] = add_vertex(d->DepList); d->VertexObjectList[It->second] = add_vertex(d->DepList);
}
// add the edges // add the edges
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
std::vector<DocumentObject*> OutList = It->second->getOutList(); std::vector<DocumentObject*> OutList = It->second->getOutList();
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) {
if (*It2) if (*It2)
add_edge(d->VertexObjectList[It->second],d->VertexObjectList[*It2],d->DepList); add_edge(d->VertexObjectList[It->second],d->VertexObjectList[*It2],d->DepList);
} }
} }
}
void Document::recompute() void Document::recompute()
{ {
@ -1115,7 +1116,7 @@ void Document::recompute()
delete *it; delete *it;
_RecomputeLog.clear(); _RecomputeLog.clear();
// updates the depency graph // updates the dependency graph
_rebuildDependencyList(); _rebuildDependencyList();
//DependencyList DepList; //DependencyList DepList;