]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
0020076: EDF VISU: SIGSEV when editing a presentation and no VTK window
authordmv <dmv@opencascade.com>
Mon, 12 Jan 2009 08:01:43 +0000 (08:01 +0000)
committerdmv <dmv@opencascade.com>
Mon, 12 Jan 2009 08:01:43 +0000 (08:01 +0000)
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_ActorBase.cxx
src/OBJECT/VISU_ActorBase.h
src/VISU_I/VISU_Prs3d_i.cc

index 2f0801ddc2a59bb533857794942929b6305eb19a..edbcbc34f09ddaaff1a94316e76b51fa215ea1e5 100644 (file)
@@ -210,13 +210,6 @@ VISU_Actor
   return myPrs3d;
 }
 
-void
-VISU_Actor
-::RemoveFromRender()
-{
-  RemoveFromRender(GetRenderer());
-}
-
 //----------------------------------------------------------------------------
 void
 VISU_Actor
index 4bcbc0911cd333b509cb3ee1a787d82d93d646e8..0f8ddca807c210521d7cf79efedeaf22369ed7b1 100644 (file)
@@ -99,10 +99,6 @@ class VISU_OBJECT_EXPORT VISU_Actor : public VISU_ActorBase
   void
   SetPrs3d(VISU::Prs3d_i* thePrs3d);
 
-  virtual
-  void
-  RemoveFromRender();
-
   //----------------------------------------------------------------------------
   virtual
   VISU_PipeLine* 
index 1fe8f75852ffb2140ebf0ed84f7bd8c32162500c..1a09a771790ec32bff200a8900a8a67befcbc8d6 100644 (file)
@@ -58,7 +58,8 @@ VISU_ActorBase
 VISU_ActorBase
 ::~VISU_ActorBase()
 {
-
+  myUpdateActorsConnection.disconnect();
+  myRemoveFromRendererConnection.disconnect();
 }
 
 //----------------------------------------------------------------------------
@@ -161,3 +162,21 @@ bool VISU_ActorBase::IsShrunkable()
 { 
   return myIsShrinkable;
 }
+
+//--------------------------------------------------------------------------------------
+
+void VISU_ActorBase::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  Superclass::RemoveFromRender(theRenderer);
+}
+
+void VISU_ActorBase::RemoveFromRender()
+{
+  RemoveFromRender(GetRenderer());
+}
+
+void VISU_ActorBase::ConnectToFactory(boost::signal0<void>& theUpdateActorSignal, boost::signal0<void>& theRemoveFromRendererSignal)
+{
+  myUpdateActorsConnection = theUpdateActorSignal.connect(boost::bind(&VISU_ActorBase::UpdateFromFactory,this));
+  myRemoveFromRendererConnection = theRemoveFromRendererSignal.connect(boost::bind(&VISU_ActorBase::RemoveFromRender,this));
+}
index 6514362466d7055e5aef299728a4b6e495505b12..7a39f0a534c2d3bd1da34ddedb632b7d3d021162 100644 (file)
@@ -31,6 +31,7 @@
 #include "VISU_OBJECT.h"
 #include "SALOME_Actor.h"
 #include "VISU_BoostSignals.h"
+#include <boost/bind.hpp>
 
 class VTKViewer_ShrinkFilter;
 
@@ -68,6 +69,11 @@ class VISU_OBJECT_EXPORT VISU_ActorBase: public SALOME_Actor,
   
   virtual void SetRepresentation(int theMode);
 
+  virtual void RemoveFromRender(vtkRenderer* theRenderer);
+  virtual void RemoveFromRender();
+
+  virtual void ConnectToFactory(boost::signal0<void>& , boost::signal0<void>&);
+
  protected:
   VISU_ActorBase();
   virtual  ~VISU_ActorBase();
@@ -76,6 +82,9 @@ class VISU_OBJECT_EXPORT VISU_ActorBase: public SALOME_Actor,
   vtkTimeStamp                         myUpdateFromFactoryTime;
   boost::signal1<void,VISU_ActorBase*> myDestroySignal;
 
+  boost::signalslib::connection        myUpdateActorsConnection;
+  boost::signalslib::connection        myRemoveFromRendererConnection;
+
   vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
 
   bool myIsShrinkable;
index 997e5010ceaad6709fe7524128bfa67ac47a7403..3ec20db4328e6cf4dab98590b1cd9df54c54ab9c 100644 (file)
@@ -503,8 +503,7 @@ VISU::Prs3d_i
     }
 
     theActor->SetFactory(this);
-    myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,theActor));
-    myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,theActor));
+    theActor->ConnectToFactory(myUpdateActorsSignal, myRemoveActorsFromRendererSignal);
 
     myActorCollection->AddItem(theActor);
     theActor->Delete();