diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index aff514d7d..683e6cb6f 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -492,9 +492,6 @@ SMESH_ActorDef::~SMESH_ActorDef() } #endif - // caught by SMESHGUI::ProcessEvents() static method - this->InvokeEvent( SMESH::DeleteActorEvent, NULL ); - myScalarBarActor->Delete(); myLookupTable->Delete(); @@ -538,6 +535,17 @@ SMESH_ActorDef::~SMESH_ActorDef() myTimeStamp->Delete(); } +void SMESH_ActorDef::Delete() +{ + // This is just to guarantee that the DeleteActorEvent (which was previously invoked + // from the actor's destructor) will be thrown before removing the actor's observers, + // that is done inside the Superclass::Delete() method but before the destructor itself + // (see the issue 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash). + // The event is caught by SMESHGUI::ProcessEvents() static method. + this->InvokeEvent( SMESH::DeleteActorEvent, NULL ); + + Superclass::Delete(); +} void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled ) { diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index d6e273921..1c257ff99 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -84,6 +84,8 @@ class SMESH_ActorDef : public SMESH_Actor public: vtkTypeMacro(SMESH_ActorDef,SMESH_Actor); + virtual void Delete(); + virtual void ReleaseGraphicsResources(vtkWindow *renWin); virtual int RenderOpaqueGeometry(vtkViewport *viewport); virtual int RenderTranslucentGeometry(vtkViewport *viewport);