0020832: EDF 1359 SMESH : Automatic meshing of boundary layers

prevent from an infinite recursion via the event listener
This commit is contained in:
eap 2011-01-18 12:11:00 +00:00
parent 4466dfe1ce
commit 78d0067647
2 changed files with 17 additions and 11 deletions

View File

@ -2068,8 +2068,6 @@ EventListenerData* SMESH_subMesh::GetEventListenerData(EventListener* listener)
* \brief Notify stored event listeners on the occured event * \brief Notify stored event listeners on the occured event
* \param event - algo_event or compute_event itself * \param event - algo_event or compute_event itself
* \param eventType - algo_event or compute_event * \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 * \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(); map< EventListener*, EventListenerData* >::iterator l_d = myEventListeners.begin();
for ( ; l_d != myEventListeners.end(); ++l_d ) 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 );
}
} }
//================================================================================ //================================================================================

View File

@ -20,10 +20,9 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_subMeshEventListener.hxx
// File : SMESH_subMeshEventListener.hxx // Created : Mon Nov 13 10:45:49 2006
// Created : Mon Nov 13 10:45:49 2006 // Author : Edward AGAPOV (eap)
// Author : Edward AGAPOV (eap)
// //
#ifndef SMESH_subMeshEventListener_HeaderFile #ifndef SMESH_subMeshEventListener_HeaderFile
#define SMESH_subMeshEventListener_HeaderFile #define SMESH_subMeshEventListener_HeaderFile
@ -31,6 +30,7 @@
#include "SMESH_SMESH.hxx" #include "SMESH_SMESH.hxx"
#include <list> #include <list>
#include <set>
class SMESH_subMesh; class SMESH_subMesh;
class SMESH_Hypothesis; 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 bool myIsDeletable; //!< if true, it will be deleted by SMESH_subMesh
mutable std::set<SMESH_subMesh*> myBusySM; //!< to avoid infinite recursion via events
friend class SMESH_subMesh;
public: public:
SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {} SMESH_subMeshEventListener(bool isDeletable):myIsDeletable(isDeletable) {}
bool IsDeletable() const { return myIsDeletable; } bool IsDeletable() const { return myIsDeletable; }
@ -55,9 +58,9 @@ public:
* \param data - listener data stored in the subMesh * \param data - listener data stored in the subMesh
* \param hyp - hypothesis, if eventType is algo_event * \param hyp - hypothesis, if eventType is algo_event
* *
* The base implementation translates CLEAN event to the subMesh stored * The base implementation (see SMESH_subMesh.cxx) translates CLEAN event
* in the listener data. Also it sends SUBMESH_COMPUTED event in case of * to the subMesh stored in the listener data. Also it sends SUBMESH_COMPUTED
* successful COMPUTE event. * event in case of successful COMPUTE event.
*/ */
virtual void ProcessEvent(const int event, virtual void ProcessEvent(const int event,
const int eventType, const int eventType,
@ -80,6 +83,7 @@ struct SMESH_subMeshEventListenerData
// on the one storing this data // on the one storing this data
public: public:
SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {} SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {}
virtual ~SMESH_subMeshEventListenerData() {}
bool IsDeletable() const { return myIsDeletable; } bool IsDeletable() const { return myIsDeletable; }
/*! /*!