From 56257bd2b3a35e3054db4d5b411a34bb8019d4dc Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 10 Oct 2005 05:49:41 +0000 Subject: [PATCH] To provide correct memory management --- src/OBJECT/VISU_Actor.cxx | 4 ++-- src/OBJECT/VISU_Actor.h | 5 ++++- src/OBJECT/VISU_ActorFactory.h | 4 ++++ src/VISU_I/VISU_Prs3d_i.cc | 10 +++++++++- src/VISU_I/VISU_Prs3d_i.hh | 4 ++++ src/VISU_I/VISU_TimeAnimation.cxx | 2 -- src/VISU_I/VISU_ViewManager_i.cc | 1 - 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 1f455ff8..89407e70 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -67,7 +67,7 @@ using namespace std; static int MYVTKDEBUG = 0; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -368,7 +368,7 @@ VISU_Actor { theRenderer->RemoveActor(myAnnotationActor.GetPointer()); Superclass::RemoveFromRender(theRenderer); - + myActorFactory->RemoveActor(this); } //---------------------------------------------------------------------------- diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index cf8efe7d..466010d7 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -35,6 +35,7 @@ #include #include #include +#include class vtkProp; class vtkProperty; @@ -57,7 +58,9 @@ namespace VISU } //---------------------------------------------------------------------------- -class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor +class VTKOCC_EXPORT VISU_Actor : + public SALOME_Actor, + public boost::bsignals::trackable { public: vtkTypeMacro(VISU_Actor,SALOME_Actor); diff --git a/src/OBJECT/VISU_ActorFactory.h b/src/OBJECT/VISU_ActorFactory.h index 29367eba..2cda6668 100644 --- a/src/OBJECT/VISU_ActorFactory.h +++ b/src/OBJECT/VISU_ActorFactory.h @@ -39,6 +39,10 @@ namespace VISU virtual void UpdateActor(VISU_Actor* theActor) = 0; + + virtual + void + RemoveActor(VISU_Actor* theActor) = 0; }; } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index a2486ce2..0fd66505 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -40,7 +40,7 @@ using namespace VISU; using namespace std; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -238,6 +238,14 @@ VISU::Prs3d_i theActor->Modified(); } +void +VISU::Prs3d_i +::RemoveActor(VISU_Actor* theActor) +{ + if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<