0000640: This file crashes FreeCAD
This commit is contained in:
parent
1b5e834ee9
commit
255d6b4011
|
@ -52,6 +52,7 @@ recompute path. Also enables more complicated dependencies beyond trees.
|
|||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <algorithm>
|
||||
# include <sstream>
|
||||
# include <climits>
|
||||
#endif
|
||||
|
@ -1452,6 +1453,31 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (pt->second->getTypeId().isDerivedFrom(PropertyLinkSubList::getClassTypeId())) {
|
||||
PropertyLinkSubList* link = static_cast<PropertyLinkSubList*>(pt->second);
|
||||
if (link->getContainer() == pcObject && clear) {
|
||||
link->setValues(std::vector<DocumentObject*>(), std::vector<std::string>());
|
||||
}
|
||||
else {
|
||||
const std::vector<DocumentObject*>& links = link->getValues();
|
||||
const std::vector<std::string>& sub = link->getSubValues();
|
||||
std::vector<DocumentObject*> newLinks;
|
||||
std::vector<std::string> newSub;
|
||||
|
||||
if (std::find(links.begin(), links.end(), pcObject) != links.end()) {
|
||||
std::vector<DocumentObject*>::const_iterator jt;
|
||||
std::vector<std::string>::const_iterator kt;
|
||||
for (jt = links.begin(),kt = sub.begin(); jt != links.end() && kt != sub.end(); ++jt, ++kt) {
|
||||
if (*jt != pcObject) {
|
||||
newLinks.push_back(*jt);
|
||||
newSub.push_back(*kt);
|
||||
}
|
||||
}
|
||||
|
||||
link->setValues(newLinks, newSub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ bool ViewProviderPocket::onDelete(const std::vector<std::string> &)
|
|||
{
|
||||
// get the support and Sketch
|
||||
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(getObject());
|
||||
Sketcher::SketchObject *pcSketch;
|
||||
App::DocumentObject *pcSupport;
|
||||
Sketcher::SketchObject *pcSketch = 0;
|
||||
App::DocumentObject *pcSupport = 0;
|
||||
if (pcPocket->Sketch.getValue()){
|
||||
pcSketch = static_cast<Sketcher::SketchObject*>(pcPocket->Sketch.getValue());
|
||||
pcSupport = pcSketch->Support.getValue();
|
||||
|
|
Loading…
Reference in New Issue
Block a user