From 4951631c9a136319e0420533465c1539581301ec Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 27 May 2015 20:01:11 +0300 Subject: [PATCH] Fix for highlight external objects for "distance" in sketch crash --- src/Model/Model_Document.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 8cc427ce8..517b4231f 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -642,6 +642,8 @@ int Model_Document::size(const std::string& theGroupID) std::shared_ptr Model_Document::currentFeature(const bool theVisible) { + if (!myObjs) // on close document feature destruction it may call this method + return std::shared_ptr(); TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE); Handle(TDF_Reference) aRef; if (aRefLab.FindAttribute(TDF_Reference::GetID(), aRef)) { @@ -734,10 +736,12 @@ void Model_Document::setCurrentFeature(std::shared_ptr theCurr void Model_Document::setCurrentFeatureUp() { - FeaturePtr aCurrent = currentFeature(true); + // on remove just go up for minimum step: highlight external objects in sketch causes + // problems if it is true: here and in "setCurrentFeature" + FeaturePtr aCurrent = currentFeature(false); if (aCurrent.get()) { // if not, do nothing because null is the upper FeaturePtr aPrev = myObjs->nextFeature(aCurrent, true); - setCurrentFeature(aPrev, true); + setCurrentFeature(aPrev, false); } } -- 2.39.2