From: eap Date: Tue, 18 Jan 2011 12:11:00 +0000 (+0000) Subject: 0020832: EDF 1359 SMESH : Automatic meshing of boundary layers X-Git-Tag: StartingPortingMED3~150 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78d00676479e4ef8f6d40fd49d86d76564fd37d8;p=modules%2Fsmesh.git 0020832: EDF 1359 SMESH : Automatic meshing of boundary layers prevent from an infinite recursion via the event listener --- diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index f90f792da..677b21fcc 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -2068,8 +2068,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 */ //================================================================================ @@ -2080,7 +2078,11 @@ 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->myBusySM.insert( this ).second ) + { + l_d->first->ProcessEvent( event, eventType, this, l_d->second, hyp ); + l_d->first->myBusySM.erase( this ); + } } //================================================================================ diff --git a/src/SMESH/SMESH_subMeshEventListener.hxx b/src/SMESH/SMESH_subMeshEventListener.hxx index 7d1f4f101..c259b9f0e 100644 --- a/src/SMESH/SMESH_subMeshEventListener.hxx +++ b/src/SMESH/SMESH_subMeshEventListener.hxx @@ -20,10 +20,9 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : SMESH_subMeshEventListener.hxx -// Created : Mon Nov 13 10:45:49 2006 -// Author : Edward AGAPOV (eap) +// File : SMESH_subMeshEventListener.hxx +// Created : Mon Nov 13 10:45:49 2006 +// Author : Edward AGAPOV (eap) // #ifndef SMESH_subMeshEventListener_HeaderFile #define SMESH_subMeshEventListener_HeaderFile @@ -31,6 +30,7 @@ #include "SMESH_SMESH.hxx" #include +#include class SMESH_subMesh; class SMESH_Hypothesis; @@ -42,8 +42,11 @@ struct SMESH_subMeshEventListenerData; */ // ------------------------------------------------------------------ -class SMESH_EXPORT SMESH_subMeshEventListener { +class SMESH_EXPORT SMESH_subMeshEventListener +{ bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh + mutable std::set myBusySM; //!< to avoid infinite recursion via events + friend class SMESH_subMesh; public: SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {} bool IsDeletable() const { return myIsDeletable; } @@ -55,9 +58,9 @@ public: * \param data - listener data stored in the subMesh * \param hyp - hypothesis, if eventType is algo_event * - * The base implementation translates CLEAN event to the subMesh stored - * in the listener data. Also it sends SUBMESH_COMPUTED event in case of - * successful COMPUTE event. + * The base implementation (see SMESH_subMesh.cxx) translates CLEAN event + * to the subMesh stored in the listener data. Also it sends SUBMESH_COMPUTED + * event in case of successful COMPUTE event. */ virtual void ProcessEvent(const int event, const int eventType, @@ -80,6 +83,7 @@ struct SMESH_subMeshEventListenerData // on the one storing this data public: SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {} + virtual ~SMESH_subMeshEventListenerData() {} bool IsDeletable() const { return myIsDeletable; } /*!