* \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
*/
//================================================================================
{
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;
+ }
}
//================================================================================
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