From da21291cc8efbf127811fd12d2a826127deb6b0a Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 19 Feb 2007 13:18:10 +0000 Subject: [PATCH] To fix an external bug with "c3d10.med" file --- src/VISU_I/VISU_ColoredPrs3dCache_i.cc | 34 ++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) 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; } -- 2.39.2