From: eap Date: Thu, 16 Dec 2010 15:41:22 +0000 (+0000) Subject: 0020832: EDF 1359 SMESH : Automatic meshing of boundary layers X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b5616f0eb9ae5606bfd508369f87a3e77c0d8fb4;p=modules%2Fsmesh.git 0020832: EDF 1359 SMESH : Automatic meshing of boundary layers prevent infinit recursion via event notification --- diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 69b33a94c..1fcbd3407 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -2067,8 +2067,6 @@ EventListenerData* SMESH_subMesh::GetEventListenerData(EventListener* listener) * \brief Notify stored event listeners on the occured event * \param event - algo_event or compute_event itself * \param eventType - algo_event or compute_event - * \param subMesh - the submesh where the event occures - * \param data - listener data stored in the subMesh * \param hyp - hypothesis, if eventType is algo_event */ //================================================================================ @@ -2079,7 +2077,12 @@ void SMESH_subMesh::NotifyListenersOnEvent( const int event, { map< EventListener*, EventListenerData* >::iterator l_d = myEventListeners.begin(); for ( ; l_d != myEventListeners.end(); ++l_d ) - l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp ); + if ( ! (*l_d).first->myIsBusy ) + { + l_d->first->myIsBusy = true; + l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp ); + l_d->first->myIsBusy = false; + } } //================================================================================ diff --git a/src/SMESH/SMESH_subMeshEventListener.hxx b/src/SMESH/SMESH_subMeshEventListener.hxx index 99e66e865..81dccca46 100644 --- a/src/SMESH/SMESH_subMeshEventListener.hxx +++ b/src/SMESH/SMESH_subMeshEventListener.hxx @@ -44,8 +44,10 @@ struct SMESH_subMeshEventListenerData; class SMESH_EXPORT SMESH_subMeshEventListener { bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh + mutable bool myIsBusy; //!< to avoid infinite recursion + friend class SMESH_subMesh; public: - SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {} + SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable),myIsBusy(false) {} bool IsDeletable() const { return myIsDeletable; } /*! * \brief Do something on a certain event