]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fixed bug 12899: Hung-up animation on dialog exit
authorvsv <vsv@opencascade.com>
Mon, 21 Aug 2006 11:06:42 +0000 (11:06 +0000)
committervsv <vsv@opencascade.com>
Mon, 21 Aug 2006 11:06:42 +0000 (11:06 +0000)
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISU_I/VISU_TimeAnimation.cxx

index 634dff471dc5751c1e646329c372f2030cbf7b58..fe7c72ff845077e7953cd0e254d809f4f95f38dd 100644 (file)
@@ -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);
index dfe9ff1e53e45eaeea870fa4e2f11dc7729f6775..ad6239f34bc063c14644a506458031ca37d7231a 100644 (file)
@@ -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;