From: apo Date: Fri, 1 Dec 2006 08:52:43 +0000 (+0000) Subject: To fix a regressions with crash on destroying Gauss Points presentation X-Git-Tag: WP1_2_3_05-12-2006_cache_system~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb0f2ded003e6e8e2c817c268884cacc5653805a;p=modules%2Fvisu.git To fix a regressions with crash on destroying Gauss Points presentation --- diff --git a/src/OBJECT/VISU_VectorsAct.cxx b/src/OBJECT/VISU_VectorsAct.cxx index 9666b568..ce2f67c3 100644 --- a/src/OBJECT/VISU_VectorsAct.cxx +++ b/src/OBJECT/VISU_VectorsAct.cxx @@ -60,8 +60,7 @@ VISU_VectorsAct ::SetPipeLine(VISU_PipeLine* thePipeLine) { myVectorsPL = dynamic_cast(thePipeLine); - VISU_Actor::SetPipeLine(myVectorsPL); - myVectorsPL->Delete(); + VISU_Actor::SetPipeLine(myVectorsPL.GetPointer()); } diff --git a/src/OBJECT/VISU_VectorsAct.h b/src/OBJECT/VISU_VectorsAct.h index 06436cc4..cc76ce48 100644 --- a/src/OBJECT/VISU_VectorsAct.h +++ b/src/OBJECT/VISU_VectorsAct.h @@ -31,6 +31,8 @@ #include "VISU_ScalarMapAct.h" +#include + class VTKViewer_Transform; class VISU_VectorsPL; @@ -68,7 +70,7 @@ class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct VISU_VectorsAct(); ~VISU_VectorsAct(); - VISU_VectorsPL* myVectorsPL; + vtkSmartPointer myVectorsPL; }; #endif diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 876baac4..43edd863 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -571,7 +571,7 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- VISU_PipeLine* VISU::GaussPoints_i -::GetPL() +::GetActorPipeLine() { // We create a new PipeLine instance in order to provide // different representations for different actors (basic and segmented) @@ -590,7 +590,6 @@ VISU::GaussPoints_i { try{ TSuperClass::CreateActor(theActor); - theActor->GetPipeLine()->Delete(); UpdateActor(theActor); return true; }catch(...){ diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 51d4abcf..cb28b472 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -277,7 +277,7 @@ namespace VISU virtual VISU_PipeLine* - GetPL(); + GetActorPipeLine(); bool OnCreateActor(VISU_GaussPtsAct* theActor); diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 651f2d8e..795c4e26 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -53,7 +53,6 @@ VISU::Prs3d_i myActorCollection(vtkActorCollection::New()), mySObject(SALOMEDS::SObject::_nil()), myIsActiveSatate(true), - myPipeLine(NULL), myResult(NULL) { if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<Delete(); } //---------------------------------------------------------------------------- @@ -402,13 +402,13 @@ bool VISU::Prs3d_i ::IsPipeLineExists() { - return myPipeLine != NULL; + return myPipeLine.GetPointer() != NULL; } //---------------------------------------------------------------------------- VISU_PipeLine* VISU::Prs3d_i -::GetPL() +::GetActorPipeLine() { return GetPipeLine(); } @@ -457,7 +457,11 @@ VISU::Prs3d_i theActor->SetPrs3d(this); theActor->SetShrinkFactor(); theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]); - theActor->SetPipeLine(GetPipeLine()); + theActor->SetPipeLine(GetActorPipeLine()); + if(theActor->GetPipeLine() != GetPipeLine()){ + // To decrease actor'ss pipeline reference counter + theActor->GetPipeLine()->Delete(); + } theActor->SetFactory(this); myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,theActor)); @@ -480,7 +484,7 @@ void VISU::Prs3d_i ::RemoveActor(VISU_Actor* theActor) { - if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<GetReferenceCount()); myActorCollection->RemoveItem(theActor); } diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 9c357194..b52c09ec 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -296,7 +296,7 @@ namespace VISU //! Gets or creates VISU_PipeLine instance for actor initilization virtual VISU_PipeLine* - GetPL(); + GetActorPipeLine(); //! To check dataset validity, throws std::exception if not valid virtual @@ -330,7 +330,7 @@ namespace VISU boost::signal0 myRemoveActorsFromRendererSignal; vtkSmartPointer myActorCollection; - VISU_PipeLine *myPipeLine; + vtkSmartPointer myPipeLine; Handle(SALOME_InteractiveObject) myIO; diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 11437699..fb73be75 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -261,7 +261,7 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU_PipeLine* VISU::Vectors_i -::GetPL() +::GetActorPipeLine() { VISU_PipeLine* aPipeLine = VISU_VectorsPL::New(); aPipeLine->SetIDMapper(GetPipeLine()->GetIDMapper()); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 80bdc051..c84c2837 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -108,7 +108,7 @@ namespace VISU virtual VISU_PipeLine* - GetPL(); + GetActorPipeLine(); VISU_VectorsPL *myVectorsPL; float myLineWidth;