]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL17668
authorapo <apo@opencascade.com>
Fri, 30 May 2008 10:49:32 +0000 (10:49 +0000)
committerapo <apo@opencascade.com>
Fri, 30 May 2008 10:49:32 +0000 (10:49 +0000)
 - TC71: REGR: copy object leads to fatal error and unknown exception
(minor coding improvements)

src/VISU_I/VISU_Gen_i.cc

index 7a6a00162752213b7c955fe18eabe987cf9d6817..c1a385e8bbd1e4b2e116e0b14d8742a1667f3533 100644 (file)
@@ -1391,14 +1391,11 @@ namespace VISU
       SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
     if(MYDEBUG) MESSAGE("Result_i::PasteInto - aListOfFileNames->length() = "<<aListOfFileNames->length());
     
-    std::string aLocalPersistentID;
+    std::ostrstream aLocalPersistentID;
     {
       std::string aCopyPersist =  aTmpDir + "copy_persistent";
-      std::ifstream anInputFileStream(aCopyPersist.c_str());
-      std::ostrstream anOutputStream;
-      anInputFileStream >> anOutputStream.rdbuf();
-      aLocalPersistentID = anOutputStream.str();
-      anInputFileStream.close();
+      std::ifstream anInputFileStream( aCopyPersist.c_str() );
+      anInputFileStream >> aLocalPersistentID.rdbuf();
     }
     
     //Just for Result::Restore to find the Comment attribute :(
@@ -1407,7 +1404,7 @@ namespace VISU
     std::string aFileName(aTmpDir);
     if(aListOfFileNames->length() > 1)
       aFileName += aListOfFileNames[1].in();
-    Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID, aFileName, false);
+    Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID.str(), aFileName, false);
     
     SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
     aFilesToRemove->length(1);