From: mpv Date: Tue, 22 Dec 2015 08:34:52 +0000 (+0300) Subject: Fix for the issue #1156 X-Git-Tag: V_2.1.0~113 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6925e1e8fb0b465d32b2ce7e0d7a32582b53858c;p=modules%2Fshaper.git Fix for the issue #1156 --- diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 6b3194d5a..4f95c72cc 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -406,10 +406,25 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa std::shared_ptr aDeleted = std::dynamic_pointer_cast(theMessage); if (aDeleted && - aDeleted->groups().find(ModelAPI_ResultPart::group()) != aDeleted->groups().end() && - !ModelAPI_Tools::findPartResult(moduleDocument(), activeDocument()).get()) // another part may be disabled + aDeleted->groups().find(ModelAPI_ResultPart::group()) != aDeleted->groups().end()) { - setActiveDocument(moduleDocument()); + // check that the current feature of the session is still the active Part (even disabled) + bool aFound = false; + FeaturePtr aCurrentPart = moduleDocument()->currentFeature(true); + if (aCurrentPart.get()) { + const std::list >& aResList = aCurrentPart->results(); + std::list >::const_iterator aRes = aResList.begin(); + for(; !aFound && aRes != aResList.end(); aRes++) { + ResultPartPtr aPRes = std::dynamic_pointer_cast(*aRes); + if (aPRes.get() && aPRes->isActivated() && aPRes->partDoc() == activeDocument()) { + aFound = true; + + } + } + } + if (!aFound) { // if not, the part was removed, so activate the module document + setActiveDocument(moduleDocument()); + } } } }