]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #930: update event of erased feature should not be processed
authormpv <mpv@opencascade.com>
Fri, 11 Sep 2015 14:08:32 +0000 (17:08 +0300)
committermpv <mpv@opencascade.com>
Fri, 11 Sep 2015 14:08:32 +0000 (17:08 +0300)
src/Events/Events_Loop.cpp
src/Events/Events_Loop.h
src/Model/Model_Objects.cpp

index 83091a254d4971b0432960bd1be432f2fc1a766f..da0d8786221b08f93fbe92fd3a338160377cec68 100644 (file)
@@ -133,6 +133,16 @@ void Events_Loop::flush(const Events_ID& theID)
   }
 }
 
+void Events_Loop::eraseMessages(const Events_ID& theID)
+{
+  std::map<char*, std::shared_ptr<Events_Message> >::iterator aMyGroup =
+    myGroups.find(theID.eventText());
+  if (aMyGroup != myGroups.end()) {
+    myGroups.erase(aMyGroup);
+  }
+}
+
+
 bool Events_Loop::activateFlushes(const bool theActivate)
 {
   bool isActive = myFlushActive;
index adc88835198dda23e4121ac4dd07620217475e19..66ed3070d58e785f994854603de2b46bdb0a0a72 100644 (file)
@@ -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
index b30356fffe7c4449f063a15733bfd1930b54c124..535acd300ce5091d18906b1caebc770036e1bce0 100644 (file)
@@ -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));