[TD]fix segfault on confused selection
- failure in DrawDimHelper when both 2d & 3d geom selected
This commit is contained in:
@@ -336,7 +336,11 @@ DrawDimHelper::minMax3d(DrawViewPart* dvp, ReferenceVector references, int direc
|
||||
TopoDS_Compound comp;
|
||||
builder.MakeCompound(comp);
|
||||
for (auto& ref : references) {
|
||||
builder.Add(comp, ref.getGeometry());
|
||||
auto tempGeom = ref.getGeometry();
|
||||
if (tempGeom.IsNull()) {
|
||||
continue;
|
||||
}
|
||||
builder.Add(comp, tempGeom);
|
||||
}
|
||||
Base::Vector3d centroid = dvp->getOriginalCentroid();
|
||||
TopoDS_Shape centeredShape =//this result is a throw away. We will work with comp.
|
||||
|
||||
@@ -2513,6 +2513,19 @@ void execExtent(Gui::Command* cmd, const std::string& dimType)
|
||||
TechDraw::DrawViewPart* partFeat =
|
||||
TechDraw::getReferencesFromSelection(references2d, references3d);
|
||||
|
||||
// if sticky selection is in use we may get confusing selections that appear to
|
||||
// include both 2d and 3d geometry for the extent dim.
|
||||
if (!references3d.empty()) {
|
||||
for (auto& ref : references2d) {
|
||||
if (!ref.getSubName().empty()) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Incorrect selection"),
|
||||
QObject::tr("Selection contains both 2d and 3d geometry"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Define the geometric configuration required for a extent dimension
|
||||
StringVector acceptableGeometry({"Edge"});
|
||||
std::vector<int> minimumCounts({1});
|
||||
|
||||
@@ -59,6 +59,7 @@ TechDraw::DrawViewPart* TechDraw::getReferencesFromSelection(ReferenceVector& re
|
||||
//subName to a null string to avoid later misunderstandings.
|
||||
ReferenceEntry ref(dvp, std::string());
|
||||
references2d.push_back(ref);
|
||||
continue;
|
||||
}
|
||||
for (auto& sub : selItem.getSubNames()) {
|
||||
ReferenceEntry ref(dvp, sub);
|
||||
@@ -192,7 +193,6 @@ DimensionGeometryType TechDraw::validateDimSelection3d(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check for invalid geometry descriptors in the subNames
|
||||
std::unordered_set<std::string> acceptableGeometrySet(acceptableGeometry.begin(),
|
||||
acceptableGeometry.end());
|
||||
|
||||
Reference in New Issue
Block a user