From: mpv Date: Tue, 30 Jul 2019 13:24:47 +0000 (+0300) Subject: Fix for the issue #2958 : Application errors when Remove part X-Git-Tag: VEDF2019Lot4~71 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6504f2e6c905fe70132e6a1e4c1567efc3a0bc7;p=modules%2Fshaper.git Fix for the issue #2958 : Application errors when Remove part --- diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index aed8b486a..89f90ee4a 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -511,9 +511,33 @@ void Model_Session::processEvent(const std::shared_ptr& theMessa } } } else { // create/update/delete - if (myCheckTransactions && !isOperation()) - Events_InfoMessage("Model_Session", - "Modification of data structure outside of the transaction").send(); + if (myCheckTransactions && !isOperation()) { + // check it is done in real opened document: 2958 + bool aIsActual = true; + static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + if (theMessage->eventID() == kDeletedEvent) { + aIsActual = false; + std::shared_ptr aDeleted = + std::dynamic_pointer_cast(theMessage); + std::list > allOpened = + Model_Session::allOpenedDocuments(); + std::list, std::string>>::const_iterator + aGIter = aDeleted->groups().cbegin(); + for (; !aIsActual && aGIter != aDeleted->groups().cend(); aGIter++) { + std::list >::iterator anOpened = allOpened.begin(); + for(; anOpened != allOpened.end(); anOpened++) { + if (aGIter->first == *anOpened) { + aIsActual = true; + break; + } + } + } + } + + if (aIsActual) + Events_InfoMessage("Model_Session", + "Modification of data structure outside of the transaction").send(); + } // if part is deleted, make the root as the current document (on undo of Parts creations) static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); if (theMessage->eventID() == kDeletedEvent) {