From: apo Date: Thu, 30 Mar 2006 07:55:49 +0000 (+0000) Subject: Fix for Bug12054 X-Git-Tag: mergeto_OCC_debug_for_3_2_0b1_07Apr06~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7d72dbfc9b29c6068d3bdba0087fc10f8c5d0fe5;p=modules%2Fvisu.git Fix for Bug12054 Gauss Viewer can?t build a presentation or crash on animation (MKO) --- diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index e22eca42..0faf02f3 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -738,6 +738,15 @@ void SetupDlg::onPreferencesDlg() if (aData.myPrs.empty()) myAnimator->generatePresentations(myFieldLst->currentItem()); + if(!aData.myNbFrames || !aData.myPrs[0]){ + QApplication::restoreOverrideCursor(); + SUIT_MessageBox::warn1(this, + tr("ERROR"), + VisuGUI_TimeAnimationDlg::tr("MSG_NO_ANIMATIONDATA"), + tr("&OK")); + return; + } + int aType = myComboId2TypeId[myTypeCombo->currentItem()]; switch (aType) { case TSCALARMAP_ITEM: //Scalar Map diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index fa5befe5..ce602533 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -42,6 +42,7 @@ #include "SALOMEDSClient_AttributeComment.hxx" #include "SALOMEDSClient_AttributeName.hxx" +#include "CASCatch.hxx" #include #include @@ -194,13 +195,27 @@ namespace QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName"); int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt(); + bool anIsCreated = false; TPrs3d* aPresent = new TPrs3d(theResult, false); - aPresent->Create(aMeshName.latin1(), anEntity, - aFieldName.latin1(), aTimeStampId); - theData.myPrs[aFrameId++] = aPresent; - - aMin = std::min(aPresent->GetMin(), aMin); - aMax = std::max(aPresent->GetMax(), aMax); + CASCatch_TRY{ + try{ + if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){ + anIsCreated = true; + theData.myPrs[aFrameId++] = aPresent; + aMin = std::min(aPresent->GetMin(), aMin); + aMax = std::max(aPresent->GetMax(), aMax); + } + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<GetMessageString()); + } + if(!anIsCreated) + aPresent->_remove_ref(); } theData.myNbFrames = aFrameId;