From: apo Date: Mon, 19 Feb 2007 13:18:10 +0000 (+0000) Subject: To fix an external bug with "c3d10.med" file X-Git-Tag: WP1_2_3_19-02-2007_Bug_fixing X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_WP1_2_3;p=modules%2Fvisu.git To fix an external bug with "c3d10.med" file --- diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 320fc577..2e5f1983 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -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; }