]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix regression with referenc counting for descendants of the SALOME::GenericObj
authorapo <apo@opencascade.com>
Thu, 28 Jun 2007 08:16:42 +0000 (08:16 +0000)
committerapo <apo@opencascade.com>
Thu, 28 Jun 2007 08:16:42 +0000 (08:16 +0000)
16 files changed:
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_Plot3DDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_VectorsDlg.cxx
src/VISU_I/SALOME_GenericObjPointer.hh
src/VISU_I/VISU_ColoredPrs3dFactory.hh
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_MultiResult_i.cc
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index d7122e5f028ccb7f2bd030c849eeb07c2996efb0..21ae371b1ee23f64e4b3d1e8847a1a4b2296a6ff 100644 (file)
@@ -363,7 +363,7 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
   if (myAllCurvesInvertedCheck->isChecked())
     myPrsCopy->SetAllCurvesInverted(true);
 
-  VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index 591a413bd7b511f9e0ccb1f13da7e7a34a86d434..6b9d3e50a56a2c16be204e7f7efc550dff8a84ce 100644 (file)
@@ -561,7 +561,7 @@ int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
   anIsOk &= myScalarPane->storeToPrsObject(myPrsCopy);
   anIsOk &= myCutPane->storeToPrsObject(myPrsCopy);
 
-  VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index ad81e44c8aa87ddb1cb877518fba0eaee869b2f3..3f06d6a192e51dfbe9e8ef061078a6c0f6347c3b 100644 (file)
@@ -166,7 +166,7 @@ int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myPrsCopy->SetScale(getFactor());
   myPrsCopy->ShowColored(isColored());
 
-  VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index b996cc3ad78cd6b6e5203ebef8fde11152f059eb..0080d2aeb0d2519f14412d8b4e86f9c2c69d24da 100644 (file)
@@ -739,7 +739,7 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
   myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
   myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
 
-  VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index e043866a10f3595ab131c0d546d88ac6f2be4b73..13a32591fa7cfb63dd0f8e602ad561ebc870860d 100644 (file)
@@ -261,7 +261,7 @@ int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
   anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
 
-  VISU::TSameAsFactory<VISU::TISOSURFACES>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TISOSURFACES>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index 3c20b0a1d73844c4c9dfd1f676c8a26ee56b23bd..ead3d4afe8deb8d603e49ecf7ed0c3fb381b77e5 100644 (file)
@@ -661,7 +661,7 @@ int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
   anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
   anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
 
-  VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index 76e5dcaf4b1ebe17d76dbba37693f49fbec4339e..e26a102eb9fcc08478c72ded8cca1a009fb9b802 100644 (file)
@@ -186,7 +186,7 @@ int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
   anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
   
-  VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(myPrsCopy, thePrs);
   
   return anIsOk;
 }
index bf8d48e447e779a3d879a32f54355f979fa9f1b4..d6f303e986b4edc14d49a8dd1fba967d10a7c608 100644 (file)
@@ -296,7 +296,7 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
   if(myUpdateScalars) 
     SetScalarField( false );
 
-  VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index d58995ee7f13f3d59c51d00504289e39594c6ff2..8d30b5fe3b23ed914ff436a0f23c4d069f700cf6 100644 (file)
@@ -439,7 +439,7 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
   //                         tr("ERR_CANT_BUILD_PRESENTATION"),
   //                         tr("BUT_OK"));
 
-  VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index 4a77ad49576b608f3d327a822c9bad363ff4f321..612271daadca2f4c7dced317b83160df1374120d 100644 (file)
@@ -256,7 +256,7 @@ int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   } else 
     myPrsCopy->SetGlyphType(VISU::Vectors::NONE);
 
-  VISU::TSameAsFactory<VISU::TVECTORS>().Copy(thePrs, myPrsCopy);
+  VISU::TSameAsFactory<VISU::TVECTORS>().Copy(myPrsCopy, thePrs);
 
   return anIsOk;
 }
index 7284984924f5760df347c742460f2868774267ad..83cd25457417995188356cca6709a0c8bc376611 100644 (file)
@@ -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;
     }
 
index f77b0d22e4d74590d6787effebef44d66fa7a72a..1852297c648a2d8c4ae8590a69cb2ca90879b190 100644 (file)
@@ -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<colored_prs3d_type_enum>::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<TColoredPrs3d>
     Create(ColoredPrs3d_i* theColoredPrs3d,
           ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
     {
-      TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode);
-      Copy(aSameColoredPrs3d, theColoredPrs3d);
+      SALOME::GenericObjPtr<TColoredPrs3d> aSameColoredPrs3d(new TColoredPrs3d(thePublishInStudyMode));
+      Copy(theColoredPrs3d, aSameColoredPrs3d);
+      aSameColoredPrs3d->Destroy();
       return aSameColoredPrs3d;
     }
   };
index be1570a5be6245f1f38d20ec34dc151272140767..1eebef219d145e35390ddabd5b6467ed1059b008 100644 (file)
@@ -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,
index cc8f5bb3a5a636785e98c6fd5faaf500c9cdd47d..e46382aa57e7fce7a182f07d535612d54efc240c 100644 (file)
 
 #include <strstream>
 
+#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 - '"<<myRepresentation2Input.size()<<"' - "<<endl;
+  if(MYDEBUG) MESSAGE("MultiResult_i::~MultiResult_i - this = "<<this<<": "<<myRepresentation2Input.size());
   TRepresentation2Input::iterator anIter = myRepresentation2Input.begin();
   for ( ; anIter != myRepresentation2Input.end() ; anIter++) {
     const PInput& anInput = anIter->second;
     std::string aFileName = anInput->GetName();
-    //cout<<"'"<<aFileName<<"'; "<<endl;
+    if(MYDEBUG) MESSAGE("'"<<aFileName<<"'; ");
     QFileInfo aFileInfo(aFileName.c_str());
     QFile(aFileInfo.absFilePath()).remove();
     QDir().rmdir(aFileInfo.dirPath(TRUE));
@@ -629,16 +635,16 @@ VISU::MultiResult_i
   TRepresentation2Input::iterator anIter = myRepresentation2Input.find(aRepresentationKey);
   if(anIter == myRepresentation2Input.end()){
     std::string aFileName = SALOMEDS_Tool::GetTmpDir() + "tmp.med";
-    //cout<<"MultiResult_i::GetInput - '"<<aFileName<<"' - "<<endl;
-    {
+    if(MYDEBUG){
+      MESSAGE("MultiResult_i::GetInput - '"<<aFileName<<"': ");
       TFileNames::const_iterator anIter = aFileNames.begin();
       for ( ; anIter != aFileNames.end() ; anIter++) {
        const MultiResult_i::TFileName& aFileName = *anIter;
-       //cout<<"'"<<aFileName<<"'; "<<endl;
+       MESSAGE("'"<<aFileName<<"'; ");
       }
     }
     int aRes = multipr::merge(aFileNames, theMeshName.c_str(), theFieldName.c_str(), aFileName.c_str());
-    //cout<<"aRes = "<<aRes<<endl;
+    if(MYDEBUG) MESSAGE("aRes = "<<aRes);
     if (aRes == 0) {
       QFile(aFileName.c_str()).remove();
       throw std::runtime_error("empty mesh"); 
index b8edb3a7bd67126549622bd1416d4d16fe24b2f3..3665a1e14e1a2d56ba84c5ebcdb8b95ca0b664d9 100644 (file)
@@ -40,7 +40,7 @@
 #include <boost/bind.hpp>
 
 #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();
   }
index 746bd9778300ad0949644f0517a13a58660c4c92..b3f851e371ff10206882626300ff27f4b35d8b8e 100644 (file)
@@ -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 !!!");