]> 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 07:58:30 +0000 (07:58 +0000)
committerdmv <dmv@opencascade.com>
Mon, 12 Jan 2009 07:58:30 +0000 (07:58 +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 dfdd2bd9ca39fc41c463c5592c2910a2eb6171a9..47e76582136af739842a0c91f7af00925294e28b 100644 (file)
@@ -165,13 +165,6 @@ VISU_Actor
   return myPrs3d;
 }
 
-void
-VISU_Actor
-::RemoveFromRender()
-{
-  RemoveFromRender(GetRenderer());
-}
-
 //----------------------------------------------------------------------------
 void
 VISU_Actor
index f1e26f34e57ec6b08173b1d5fa5dfecc55b98ef8..8e6b9367057c6ebe36e56dafb13bb23235b9dbf2 100644 (file)
@@ -96,10 +96,6 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
   void
   SetPrs3d(VISU::Prs3d_i* thePrs3d);
 
-  virtual
-  void
-  RemoveFromRender();
-
   //----------------------------------------------------------------------------
   virtual
   VISU_PipeLine* 
index 0f6d2bc4999fdcc51a01166fd96e46a070834197..391fd0261bdba93f2ed04fa9bbfc84082161a13f 100644 (file)
@@ -60,7 +60,8 @@ VISU_ActorBase
 VISU_ActorBase
 ::~VISU_ActorBase()
 {
-
+  myUpdateActorsConnection.disconnect();
+  myRemoveFromRendererConnection.disconnect();
 }
 
 //----------------------------------------------------------------------------
@@ -163,3 +164,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 dd11fde6c4b0c2df94b0edc5b8b9dbc7b70105be..7014dd755ba63952c21b3f2b802c6f27c491607f 100644 (file)
@@ -29,6 +29,7 @@
 #define VISU_ACTOR_BASE_H
 
 #include "SALOME_Actor.h"
+#include <boost/bind.hpp>
 #include "VISU_BoostSignals.h"
 
 class VTKViewer_ShrinkFilter;
@@ -71,10 +72,14 @@ class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor,
   virtual bool IsShrunkable();
   virtual bool IsShrunk();
   virtual void SetShrinkable(bool theIsShrinkable);
-  
 
   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();
@@ -83,6 +88,9 @@ class VTKOCC_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 89365fa83b8da3bb13869edabb9151991763e602..17710dacca0c18ca589999ecf005455314296898 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();