From: dmv Date: Mon, 12 Jan 2009 07:58:30 +0000 (+0000) Subject: 0020076: EDF VISU: SIGSEV when editing a presentation and no VTK window X-Git-Tag: V4_1_0_maintainance_20090206~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8bfa2ae3b3ce85e5baf22909faf091e17f7194fd;p=modules%2Fvisu.git 0020076: EDF VISU: SIGSEV when editing a presentation and no VTK window --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index dfdd2bd9..47e76582 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -165,13 +165,6 @@ VISU_Actor return myPrs3d; } -void -VISU_Actor -::RemoveFromRender() -{ - RemoveFromRender(GetRenderer()); -} - //---------------------------------------------------------------------------- void VISU_Actor diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index f1e26f34..8e6b9367 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -96,10 +96,6 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase void SetPrs3d(VISU::Prs3d_i* thePrs3d); - virtual - void - RemoveFromRender(); - //---------------------------------------------------------------------------- virtual VISU_PipeLine* diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx index 0f6d2bc4..391fd026 100644 --- a/src/OBJECT/VISU_ActorBase.cxx +++ b/src/OBJECT/VISU_ActorBase.cxx @@ -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& theUpdateActorSignal, boost::signal0& theRemoveFromRendererSignal) +{ + myUpdateActorsConnection = theUpdateActorSignal.connect(boost::bind(&VISU_ActorBase::UpdateFromFactory,this)); + myRemoveFromRendererConnection = theRemoveFromRendererSignal.connect(boost::bind(&VISU_ActorBase::RemoveFromRender,this)); +} diff --git a/src/OBJECT/VISU_ActorBase.h b/src/OBJECT/VISU_ActorBase.h index dd11fde6..7014dd75 100644 --- a/src/OBJECT/VISU_ActorBase.h +++ b/src/OBJECT/VISU_ActorBase.h @@ -29,6 +29,7 @@ #define VISU_ACTOR_BASE_H #include "SALOME_Actor.h" +#include #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& , boost::signal0&); + protected: VISU_ActorBase(); virtual ~VISU_ActorBase(); @@ -83,6 +88,9 @@ class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor, vtkTimeStamp myUpdateFromFactoryTime; boost::signal1 myDestroySignal; + boost::signalslib::connection myUpdateActorsConnection; + boost::signalslib::connection myRemoveFromRendererConnection; + vtkSmartPointer myShrinkFilter; bool myIsShrinkable; diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 89365fa8..17710dac 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -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();