From 7fb62fa4f588717eaffdcba56c032fba99def105 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 10 Jul 2015 18:20:45 +0300 Subject: [PATCH] Issue #711 Fatal error when Create extrusion cut Chash by mpv: in sketch of Extrusion cut try to move over external edge, result is crash. It is caused by recursive delete of referenced features to the external edge. The extrusion cut was in the list of deleted features. --- src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp | 3 ++- src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp | 3 ++- src/PartSet/PartSet_ExternalObjectsMgr.cpp | 2 -- src/PartSet/PartSet_MenuMgr.cpp | 4 +--- src/PartSet/PartSet_Module.cpp | 5 +---- src/XGUI/XGUI_Workshop.h | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp index cc0b7b783..a89523b88 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp @@ -79,7 +79,8 @@ void FeaturesPlugin_ExtrusionBoolean::makeSolids(const ListOfShape& theFaces, aFromShape, aFromSize); // Checking that the algorithm worked properly. - if(!aPrismAlgo->isDone() || aPrismAlgo->shape()->isNull() || !aPrismAlgo->isValid()) { + if(!aPrismAlgo->isDone() || !aPrismAlgo->shape().get() || aPrismAlgo->shape()->isNull() || + !aPrismAlgo->isValid()) { setError("Extrusion algorithm failed"); theResults.clear(); return; diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp index 7fd3e44cd..d2ec7bd66 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp @@ -96,7 +96,8 @@ void FeaturesPlugin_RevolutionBoolean::makeSolids(const ListOfShape& theFaces, aFromShape, aFromAngle); // Checking that the algorithm worked properly. - if(!aRevolAlgo->isDone() || aRevolAlgo->shape()->isNull() || !aRevolAlgo->isValid()) { + if(!aRevolAlgo->isDone() || !aRevolAlgo->shape().get() || aRevolAlgo->shape()->isNull() || + !aRevolAlgo->isValid()) { setError("Revolution algorithm failed"); theResults.clear(); return; diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.cpp b/src/PartSet/PartSet_ExternalObjectsMgr.cpp index e171f43b5..2cdcd24bf 100644 --- a/src/PartSet/PartSet_ExternalObjectsMgr.cpp +++ b/src/PartSet/PartSet_ExternalObjectsMgr.cpp @@ -90,7 +90,6 @@ void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSk anObjects.append(aFeature); // the external feature should be removed with all references, sketch feature should be ignored std::set anIgnoredFeatures; - anIgnoredFeatures.insert(theSketch); // the current feature should be ignored, because it can use the external feature in the // attributes and, therefore have a references to it. So, the delete functionality tries // to delete this feature. Test case is creation of a constraint on external point, @@ -149,7 +148,6 @@ void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject anObjects.append(aFeature); // the external feature should be removed with all references, sketch feature should be ignored std::set anIgnoredFeatures; - anIgnoredFeatures.insert(theSketch); // the current feature should be ignored, because it can use the external feature in the // attributes and, therefore have a references to it. So, the delete functionality tries // to delete this feature. Test case is creation of a constraint on external point, diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index e09654f96..dfc184a42 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -283,12 +283,10 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction) anOperation->abort(); SessionPtr aMgr = ModelAPI_Session::get(); - std::set anIgnoredFeatures; - anIgnoredFeatures.insert(myModule->sketchMgr()->activeSketch()); QString aName = tr("Detach %1").arg(aLine->data()->name().c_str()); aMgr->startOperation(aName.toStdString()); - aWorkshop->deleteFeatures(aToDelFeatures, anIgnoredFeatures); + aWorkshop->deleteFeatures(aToDelFeatures); aMgr->finishOperation(); } myCoinsideLines.clear(); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 9559e6bb5..018ae1706 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -605,10 +605,7 @@ bool PartSet_Module::deleteObjects() // 4. delete features // sketch feature should be skipped, only sub-features can be removed // when sketch operation is active - std::set anIgnoredFeatures; - anIgnoredFeatures.insert(mySketchMgr->activeSketch()); - aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures); - + aWorkshop->deleteFeatures(aSketchObjects); // 5. stop operation aWorkshop->displayer()->updateViewer(); aMgr->finishOperation(); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 92be69c9d..eda29c115 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -219,7 +219,7 @@ Q_OBJECT //! objects features appear. If the user chose do not continue, the deletion is not performed //! \return the success of the delete bool deleteFeatures(const QObjectPtrList& theList, - const std::set& theIgnoredFeatures, + const std::set& theIgnoredFeatures = std::set(), QWidget* theParent = 0, const bool theAskAboutDeleteReferences = false); -- 2.39.2