]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix an external bug with "c3d10.med" file BR_WP1_2_3 WP1_2_3_19-02-2007_Bug_fixing start_BR_mergefrom_BR_Dev_For_4_0
authorapo <apo@opencascade.com>
Mon, 19 Feb 2007 13:18:10 +0000 (13:18 +0000)
committerapo <apo@opencascade.com>
Mon, 19 Feb 2007 13:18:10 +0000 (13:18 +0000)
src/VISU_I/VISU_ColoredPrs3dCache_i.cc

index 320fc577f6371d7ae52ed4a6df78a01c4fc3e444..2e5f1983322a9919f7791b5a1c3b38ed5253d31c 100644 (file)
@@ -391,15 +391,16 @@ VISU::ColoredPrs3dCache_i
   if(MYDEBUG) cout << "CreateHolder " << theType << endl;
   CORBA::Float aRequiredMemory = 0.0;
   if(IsPossible(theType, theInput, aRequiredMemory, "")){
-    VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(*this);
-    VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput);
-    std::string aComment = std::string("myComment=") + aColoredPrs3d->GetComment();
-    std::string aName = aColoredPrs3d->GenerateName().latin1();
-    aHolder->PublishInStudy(aName, aComment);
-    RegisterInHolder(aColoredPrs3d, aHolder->GetEntry());
-    if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
-      ClearMemory( aRequiredMemory, aHolder->GetEntry() );
-    return aHolder->_this();
+    if(VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput)){
+      VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(*this);
+      std::string aComment = std::string("myComment=") + aColoredPrs3d->GetComment();
+      std::string aName = aColoredPrs3d->GenerateName().latin1();
+      aHolder->PublishInStudy(aName, aComment);
+      RegisterInHolder(aColoredPrs3d, aHolder->GetEntry());
+      if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
+       ClearMemory( aRequiredMemory, aHolder->GetEntry() );
+      return aHolder->_this();
+    }
   }
   return VISU::ColoredPrs3dHolder::_nil();
 }
@@ -485,8 +486,9 @@ VISU::ColoredPrs3dCache_i
   aPrs3d->SetEntity( theInput.myEntity );  
   aPrs3d->SetFieldName( theInput.myFieldName );  
   aPrs3d->SetTimeStampNumber( theInput.myTimeStampNumber );
-  aPrs3d->Apply( false );
-  return aPrs3d;
+  if(aPrs3d->Apply( false ))
+    return aPrs3d;
+  return NULL;
 }
 
 
@@ -497,10 +499,12 @@ VISU::ColoredPrs3dCache_i
                   const std::string& theHolderEntry)
 {
   if(MYDEBUG) cout << "RegisterInHolder " << theHolderEntry.c_str() << " " << thePrs3d << endl;
-  TPrs3dPtr aPrs3d(thePrs3d);
-  myHolderMap[theHolderEntry].push_front(aPrs3d);  
-  thePrs3d->SetHolderEntry( theHolderEntry );
-  thePrs3d->Destroy();
+  if(thePrs3d){
+    TPrs3dPtr aPrs3d(thePrs3d);
+    myHolderMap[theHolderEntry].push_front(aPrs3d);  
+    thePrs3d->SetHolderEntry( theHolderEntry );
+    thePrs3d->Destroy();
+  }
   return thePrs3d;
 }