From: apo Date: Thu, 28 Jun 2007 08:16:42 +0000 (+0000) Subject: To fix regression with referenc counting for descendants of the SALOME::GenericObj X-Git-Tag: T_MULTIPR_INDUS_Dump_python~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b07d05ca16639f8e035b5a43c69a75f16c6899ab;p=modules%2Fvisu.git To fix regression with referenc counting for descendants of the SALOME::GenericObj --- diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index d7122e5f..21ae371b 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -363,7 +363,7 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs) if (myAllCurvesInvertedCheck->isChecked()) myPrsCopy->SetAllCurvesInverted(true); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 591a413b..6b9d3e50 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -561,7 +561,7 @@ int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs) anIsOk &= myScalarPane->storeToPrsObject(myPrsCopy); anIsOk &= myCutPane->storeToPrsObject(myPrsCopy); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index ad81e44c..3f06d6a1 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -166,7 +166,7 @@ int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) myPrsCopy->SetScale(getFactor()); myPrsCopy->ShowColored(isColored()); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index b996cc3a..0080d2ae 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -739,7 +739,7 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) myPrsCopy->SetMagnification( mySizeBox->getMagnification() ); myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() ); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx index e043866a..13a32591 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -261,7 +261,7 @@ int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy ); anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy ); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 3c20b0a1..ead3d4af 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -661,7 +661,7 @@ int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs) anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy ); anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy ); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 76e5dcaf..e26a102e 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -186,7 +186,7 @@ int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) int anIsOk = myInputPane->storeToPrsObject( myPrsCopy ); anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy ); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index bf8d48e4..d6f303e9 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -296,7 +296,7 @@ VisuGUI_ScalarMapOnDeformedShapeDlg if(myUpdateScalars) SetScalarField( false ); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index d58995ee..8d30b5fe 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -439,7 +439,7 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs) // tr("ERR_CANT_BUILD_PRESENTATION"), // tr("BUT_OK")); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index 4a77ad49..612271da 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -256,7 +256,7 @@ int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) } else myPrsCopy->SetGlyphType(VISU::Vectors::NONE); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); return anIsOk; } diff --git a/src/VISU_I/SALOME_GenericObjPointer.hh b/src/VISU_I/SALOME_GenericObjPointer.hh index 72849849..83cd2545 100644 --- a/src/VISU_I/SALOME_GenericObjPointer.hh +++ b/src/VISU_I/SALOME_GenericObjPointer.hh @@ -101,7 +101,8 @@ namespace SALOME GenericObjPtr& operator=(TGenericObj* thePointer) { - GenericObjPtr(thePointer).swap(*this); + GenericObjPtr aTmp(thePointer); + aTmp.swap(*this); return *this; } @@ -112,7 +113,8 @@ namespace SALOME GenericObjPtr& operator=(const GenericObjPtr& thePointer) { - GenericObjPtr(thePointer).swap(*this); + GenericObjPtr aTmp(thePointer); + aTmp.swap(*this); return *this; } diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh index f77b0d22..1852297c 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.hh +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.hh @@ -32,6 +32,7 @@ #include CORBA_SERVER_HEADER(SALOMEDS) #include "VISU_I.hxx" +#include "SALOME_GenericObjPointer.hh" #include "VISU_ScalarMapOnDeformedShape_i.hh" #include "VISU_Plot3D_i.hh" #include "VISU_GaussPoints_i.hh" @@ -274,7 +275,7 @@ namespace VISU typedef typename TL::TColoredEnum2Type::TResult TColoredPrs3d; void - Copy(ColoredPrs3d_i* theColoredPrs3dTo, ColoredPrs3d_i* theColoredPrs3dFrom) + Copy(ColoredPrs3d_i* theColoredPrs3dFrom, ColoredPrs3d_i* theColoredPrs3dTo) { theColoredPrs3dTo->SetCResult(theColoredPrs3dFrom->GetCResult()); theColoredPrs3dTo->SetMeshName(theColoredPrs3dFrom->GetCMeshName().c_str()); @@ -284,12 +285,13 @@ namespace VISU theColoredPrs3dTo->SameAs(theColoredPrs3dFrom); } - TColoredPrs3d* + SALOME::GenericObjPtr Create(ColoredPrs3d_i* theColoredPrs3d, ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { - TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode); - Copy(aSameColoredPrs3d, theColoredPrs3d); + SALOME::GenericObjPtr aSameColoredPrs3d(new TColoredPrs3d(thePublishInStudyMode)); + Copy(theColoredPrs3d, aSameColoredPrs3d); + aSameColoredPrs3d->Destroy(); return aSameColoredPrs3d; } }; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index be1570a5..1eebef21 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -70,10 +70,7 @@ VISU::GaussPoints_i return aResult; try{ bool anIsEstimated = true; - VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName, - theEntity, - theFieldName, - theTimeStampNumber); + VISU::Result_i::PInput anInput = theResult->GetInput(); size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName, (VISU::TEntity)theEntity, theFieldName, diff --git a/src/VISU_I/VISU_MultiResult_i.cc b/src/VISU_I/VISU_MultiResult_i.cc index cc8f5bb3..e46382aa 100644 --- a/src/VISU_I/VISU_MultiResult_i.cc +++ b/src/VISU_I/VISU_MultiResult_i.cc @@ -45,6 +45,12 @@ #include +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + namespace VISU { @@ -465,12 +471,12 @@ VISU::MultiResult_i VISU::MultiResult_i ::~MultiResult_i() { - //cout<<"MultiResult_i::~MultiResult_i - '"<second; std::string aFileName = anInput->GetName(); - //cout<<"'"< #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -153,14 +153,9 @@ void VISU::Prs3d_i ::SetCResult(VISU::Result_i* theResult) { - VISU::Result_i* aResult = GetCResult(); - if(aResult != theResult){ - if(aResult) - aResult->Destroy(); - if(theResult){ - theResult->Register(); + if(GetCResult() != theResult){ + if(theResult) SetStudyDocument(theResult->GetStudyDocument()); - } myResult = theResult; myParamsTime.Modified(); } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 746bd977..b3f851e3 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -407,7 +407,10 @@ void VISU::ScalarMap_i ::DoSetInput(bool theIsInitilizePipe, bool theReInit) { - VISU::Result_i::PInput anInput = GetCResult()->GetInput(); + VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(), + GetEntity(), + GetCFieldName(), + GetTimeStampNumber()); if(!anInput) throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");