]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021422: EDF 1963 SMESH: Viscous layer algorithm fails in some cases
authoreap <eap@opencascade.com>
Wed, 30 Nov 2011 13:47:05 +0000 (13:47 +0000)
committereap <eap@opencascade.com>
Wed, 30 Nov 2011 13:47:05 +0000 (13:47 +0000)
  In NotifyListenersOnEvent(), enable removal of a listener from
   myEventListeners by its ProcessEvent()

src/SMESH/SMESH_subMesh.cxx

index 73b130c91516791815541919421e656408a07b98..73bd794f52a9ed8944e0ae67de0653fd22ce4fda 100644 (file)
@@ -2073,11 +2073,17 @@ void SMESH_subMesh::NotifyListenersOnEvent( const int         event,
 {
   map< EventListener*, EventListenerData* >::iterator l_d = myEventListeners.begin();
   for ( ; l_d != myEventListeners.end(); ++l_d )
-    if ( (*l_d).first->myBusySM.insert( this ).second )
+  {
+    std::pair< EventListener*, EventListenerData* > li_da = *l_d; /* copy to enable removal
+                                                                     of a listener from
+                                                                     myEventListeners by
+                                                                     its ProcessEvent() */
+    if ( li_da.first->myBusySM.insert( this ).second )
     {
-      l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp );
-      l_d->first->myBusySM.erase( this );
+      li_da.first->ProcessEvent( event, eventType, this, li_da.second, hyp );
+      li_da.first->myBusySM.erase( this );
     }
+  }
 }
 
 //================================================================================