From 8c17ba227bb10ceb56f2e20f6ebc9b2b1ae8916b Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 25 Nov 2005 06:51:07 +0000 Subject: [PATCH] Fix for Bug GVIEW10644 animation causes SIGSEGV error while loading sandia file --- src/VISUGUI/VisuGUI.cxx | 9 +++++++-- src/VISU_I/VISU_TimeAnimation.cxx | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index bb06d575..512a2f7b 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1546,9 +1546,11 @@ void VisuGUI:: OnTimeAnimation() { + if(!VISU::GetViewWindow()) + return; + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); VisuGUI_TimeAnimationDlg* aAnimationDlg = -// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy); new VisuGUI_TimeAnimationDlg (this, aCStudy); SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); @@ -1583,6 +1585,9 @@ void VisuGUI:: OnShowAnimation() { + if(!VISU::GetViewWindow()) + return; + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); @@ -2480,7 +2485,7 @@ createPopupMenus() aRule = "client='VTKViewer' and selcount=1" + aInsideType; mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true ); - aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1"; + aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1 and activeView='VTKViewer'"; mgr->setRule( action( VISU_ANIMATION ), aRule, true ); aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}"; diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 052eca5d..f70ad911 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -122,6 +122,10 @@ void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField) //************************************************************************ void VISU_TimeAnimation::clearData(FieldData& theData) { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } theData.myTiming.clear(); vtkRenderer* aRen = myView->getRenderer(); if (!theData.myActors.empty()) { @@ -358,6 +362,10 @@ void VISU_TimeAnimation::startAnimation() { //************************************************************************ void VISU_TimeAnimation::nextFrame() { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } stopAnimation(); if (myFrame < (myFieldsLst[0].myNbFrames-1)) { int i; @@ -377,6 +385,10 @@ void VISU_TimeAnimation::nextFrame() { //************************************************************************ void VISU_TimeAnimation::prevFrame() { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } stopAnimation(); if (myFrame > 0) { int i; @@ -396,6 +408,10 @@ void VISU_TimeAnimation::prevFrame() { //************************************************************************ void VISU_TimeAnimation::firstFrame() { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } stopAnimation(); int i; for (i = 0; i < getNbFields(); i++) @@ -415,6 +431,10 @@ void VISU_TimeAnimation::firstFrame() { //************************************************************************ void VISU_TimeAnimation::lastFrame() { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } stopAnimation(); int i; for (i = 0; i < getNbFields(); i++) @@ -434,6 +454,10 @@ void VISU_TimeAnimation::lastFrame() { //************************************************************************ // For Batchmode using void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) { + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } if ((theFrame < 0) || (theFrame > (getNbFrames()-1))) return; stopAnimation(); -- 2.39.2