From d61f126b5d84dcf2334e35589a1aaf80e3aa947a Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 11 Sep 2015 17:08:32 +0300 Subject: [PATCH] Fix for the issue #930: update event of erased feature should not be processed --- src/Events/Events_Loop.cpp | 10 ++++++++++ src/Events/Events_Loop.h | 3 +++ src/Model/Model_Objects.cpp | 5 ++++- 3 files changed, 17 insertions(+), 1 deletion(-) 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)); -- 2.39.2