From b6aab8c7f6a67a2ae5018bfc913f0143131b23c9 Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 25 Apr 2012 14:19:17 +0000 Subject: [PATCH] 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash --- src/OBJECT/SMESH_Actor.cxx | 14 +++++++++++--- src/OBJECT/SMESH_ActorDef.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) 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); -- 2.39.2