//------------------------------------------------------------------------
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;
// * 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);
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.
}
qApp->unlock();
msleep(delay);
+ if (!myIsActive) {
+ emit stopped();
+ return;
+ }
qApp->lock();
if (isDumping)
// 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;