]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To provide correct memory management
authorapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:49:41 +0000 (05:49 +0000)
committerapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:49:41 +0000 (05:49 +0000)
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_ActorFactory.h
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_ViewManager_i.cc

index 1f455ff855e87cc3732879402f3c94a9184e12db..89407e70fb372eb3e043bb32baef49f778c33946 100644 (file)
@@ -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);
 }
 
 //----------------------------------------------------------------------------
index cf8efe7df8b745e7a28721e20c21846912605cc1..466010d7fa1a59bc57c3a9eade24d5bb48d314ac 100644 (file)
@@ -35,6 +35,7 @@
 #include <string>
 #include <vtkSmartPointer.h>
 #include <boost/signals/signal1.hpp>
+#include <boost/signals/trackable.hpp>
 
 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);
index 29367ebadc7df5b4e74e03f11484493e352efb1f..2cda66685c7d1ce9a106cbe19bbe464c0b9c3f5b 100644 (file)
@@ -39,6 +39,10 @@ namespace VISU
     virtual 
     void
     UpdateActor(VISU_Actor* theActor) = 0;
+
+    virtual 
+    void
+    RemoveActor(VISU_Actor* theActor) = 0;
   };
 }
 
index a2486ce29b7655cff426496fd93e089391a1933d..0fd66505f533e812161f5340999ca882664ef215 100644 (file)
@@ -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 = "<<this<<"; theActor = "<<theActor);
+  myActorCollection->RemoveItem(theActor);
+}
+
 void
 VISU::Prs3d_i
 ::UpdateActors()
index 5d560d70d75b0c76473a13f475e2433eef7e555a..7bad0b68048906198ab95dee51e4a5e10052a5b8 100644 (file)
@@ -124,6 +124,10 @@ namespace VISU
     VISU_Actor* 
     CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
 
+    virtual 
+    void
+    RemoveActor(VISU_Actor* theActor);
+
     virtual 
     void
     UpdateActor(VISU_Actor* theActor);
index 46ec8a89683a25930196529be6e25aedc0c72163..c4049d7a40402d4d2e8f23b62a81d0624220c81b 100644 (file)
@@ -125,7 +125,6 @@ void VISU_TimeAnimation::clearData(FieldData& theData) {
     for (int i = 0, iEnd = theData.myActors.size(); i < iEnd; i++) {
       if (theData.myActors[i] != 0) {
        theData.myActors[i]->RemoveFromRender(aRen);
-       theData.myActors[i]->Delete();
       }
     }
     theData.myActors.clear();
@@ -333,7 +332,6 @@ void VISU_TimeAnimation::clearView() {
       for (int i = 0, iEnd = aData.myActors.size(); i < iEnd; i++) {
        if (aData.myActors[i] != 0) {
          aData.myActors[i]->RemoveFromRender(aRen);
-         aData.myActors[i]->Delete();
        }
       }
       aData.myActors.clear();
index 2db4d2a30b4b6a0873daec59052c02c86a37b90f..df191e3e41d3f5f5ad52ee1f836df383aa5c6308 100644 (file)
@@ -694,7 +694,6 @@ namespace VISU {
             }
             if (anActor) {
              vw->RemoveActor(anActor);
-             anActor->Delete();
             }
           }
         }