Fix crash when deleting View with Dimensions
- if a Dimension has multiple references to a DrawViewPart (ex vertex-vertex) the Dimension will appear twice in the DVP's InList. This commit ensures that the Dimension is only deleted once when deleting the DVP.
This commit is contained in:
committed by
Yorik van Havre
parent
7f49a1ac18
commit
79dff6b8cc
@@ -522,11 +522,14 @@ std::vector<TechDraw::DrawGeomHatch*> DrawViewPart::getGeomHatches() const
|
||||
return result;
|
||||
}
|
||||
|
||||
//return *unique* list of Dimensions which reference this DVP
|
||||
std::vector<TechDraw::DrawViewDimension*> DrawViewPart::getDimensions() const
|
||||
{
|
||||
std::vector<TechDraw::DrawViewDimension*> result;
|
||||
std::vector<App::DocumentObject*> children = getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
|
||||
std::sort(children.begin(),children.end(),std::less<App::DocumentObject*>());
|
||||
std::vector<App::DocumentObject*>::iterator newEnd = std::unique(children.begin(),children.end());
|
||||
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != newEnd; ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(DrawViewDimension::getClassTypeId())) {
|
||||
TechDraw::DrawViewDimension* dim = dynamic_cast<TechDraw::DrawViewDimension*>(*it);
|
||||
result.push_back(dim);
|
||||
|
||||
Reference in New Issue
Block a user