From: vsv Date: Mon, 21 Aug 2006 11:06:42 +0000 (+0000) Subject: Fixed bug 12899: Hung-up animation on dialog exit X-Git-Tag: Before_Merging_V3_2_0_maintainance_21Sep06~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23700a225a089bf67d1a27546d6200d3804891fe;p=modules%2Fvisu.git Fixed bug 12899: Hung-up animation on dialog exit --- diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 634dff47..fe7c72ff 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1354,9 +1354,18 @@ void VisuGUI_TimeAnimationDlg::reject() //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) { - if(myAnimator != NULL){ + if (isClosing) { + if(theEvent->type() == QEvent::Close){ + for (int i = 0; i < myAnimator->getNbFields(); i++) + myAnimator->clearData(myAnimator->getFieldData(i)); + myAnimator->clearFieldData(); + } + QDialog::closeEvent(theEvent); + return; + } + if(myAnimator != NULL){ myAnimator->stopAnimation(); - myAnimator->wait(500); + myAnimator->wait(); if (myAnimator->running() && (! myAnimator->finished())) { isClosing = true; myEvent = theEvent; @@ -1364,12 +1373,12 @@ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) // * It needed for correcting destroing of myAnimator, which // * depend from SVTK_RenderWindowInteractor() e.t.c. if(theEvent->type() == QEvent::Close){ - for (int i = 0; i < myAnimator->getNbFields(); i++) - myAnimator->clearData(myAnimator->getFieldData(i)); - myAnimator->clearFieldData(); + for (int i = 0; i < myAnimator->getNbFields(); i++) + myAnimator->clearData(myAnimator->getFieldData(i)); + myAnimator->clearFieldData(); } } else { - QDialog::closeEvent(theEvent); + QDialog::closeEvent(theEvent); } } else { QDialog::closeEvent(theEvent); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index dfe9ff1e..ad6239f3 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -116,7 +116,7 @@ VISU_TimeAnimation::~VISU_TimeAnimation() for (int i = 0; i < getNbFields(); i++) { clearData(myFieldsLst[i]); } - + clearFieldData(); /* Terminates the execution of the thread. * The thread may or may not be terminated immediately, * depending on the operating system's scheduling policies. @@ -654,6 +654,10 @@ void VISU_TimeAnimation::run() } qApp->unlock(); msleep(delay); + if (!myIsActive) { + emit stopped(); + return; + } qApp->lock(); if (isDumping) @@ -661,6 +665,10 @@ void VISU_TimeAnimation::run() // We must unlock mutex for some time before grabbing to allow view updating qApp->unlock(); msleep(delay); + if (!myIsActive) { + emit stopped(); + return; + } qApp->lock(); if(!(myFieldsLst[0].myField)) // break, if field was deleted. break;