From: dmv Date: Mon, 12 Jan 2009 08:01:43 +0000 (+0000) Subject: 0020076: EDF VISU: SIGSEV when editing a presentation and no VTK window X-Git-Tag: before_mergefrom_BR_V5_IMP_P8_22Jan09~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b1a927655eac1885290e0473d15c307d46798686;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 2f0801dd..edbcbc34 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -210,13 +210,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 4bcbc091..0f8ddca8 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -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* diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx index 1fe8f758..1a09a771 100644 --- a/src/OBJECT/VISU_ActorBase.cxx +++ b/src/OBJECT/VISU_ActorBase.cxx @@ -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& 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 65143624..7a39f0a5 100644 --- a/src/OBJECT/VISU_ActorBase.h +++ b/src/OBJECT/VISU_ActorBase.h @@ -31,6 +31,7 @@ #include "VISU_OBJECT.h" #include "SALOME_Actor.h" #include "VISU_BoostSignals.h" +#include 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& , boost::signal0&); + protected: VISU_ActorBase(); virtual ~VISU_ActorBase(); @@ -76,6 +82,9 @@ class VISU_OBJECT_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 997e5010..3ec20db4 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();