From: mpv Date: Fri, 11 Sep 2015 14:08:32 +0000 (+0300) Subject: Fix for the issue #930: update event of erased feature should not be processed X-Git-Tag: V_1.4.0_beta4~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d61f126b5d84dcf2334e35589a1aaf80e3aa947a;p=modules%2Fshaper.git Fix for the issue #930: update event of erased feature should not be processed --- diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index 83091a254..da0d87862 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -133,6 +133,16 @@ void Events_Loop::flush(const Events_ID& theID) } } +void Events_Loop::eraseMessages(const Events_ID& theID) +{ + std::map >::iterator aMyGroup = + myGroups.find(theID.eventText()); + if (aMyGroup != myGroups.end()) { + myGroups.erase(aMyGroup); + } +} + + bool Events_Loop::activateFlushes(const bool theActivate) { bool isActive = myFlushActive; diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index adc888351..66ed3070d 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -66,6 +66,9 @@ class Events_Loop //! Initializes sending of a group-message by the given ID EVENTS_EXPORT void flush(const Events_ID& theID); + //! Removes messages with the given ID: they are not needed anymore (UPDATE on close) + EVENTS_EXPORT void eraseMessages(const Events_ID& theID); + //! Allows to disable flushes: needed in synchronization of document mechanism //! (to synchronize all and only then flush create, update, etc in correct order) //! \param theActivate a state about flushe is active. If false, the flush is disabled diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index b30356fff..535acd300 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -79,7 +79,10 @@ Model_Objects::~Model_Objects() myFeatures.UnBind(aFeaturesIter.Key()); } aLoop->activateFlushes(isActive); - aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + // erase update, because features are destroyed and update should not performed for them anywhere + aLoop->eraseMessages(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + aLoop->eraseMessages(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + // deleted and redisplayed is correctly performed: they know that features are destroyed aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));