From: enk Date: Wed, 19 Apr 2006 07:34:23 +0000 (+0000) Subject: Fix for "Escape" button X-Git-Tag: T3_2_0b1_pre1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f8c61e22cfc4f50cedf0bc299dd266cbbec048c;p=modules%2Fvisu.git Fix for "Escape" button Fix for Bug IPAL11935: Crash after close "Animation" dialog box with saving pictures --- diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index bb6f4078..60e896e2 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -95,6 +95,23 @@ VISU_TimeAnimation::~VISU_TimeAnimation() for (int i = 0; i < getNbFields(); i++) { clearData(myFieldsLst[i]); } + + /* Terminates the execution of the thread. + * The thread may or may not be terminated immediately, + * depending on the operating system's scheduling policies. + * + * Use QThread::wait() after terminate() for synchronous termination. + * + * When the thread is terminated, all threads waiting for the the thread to finish will be woken up. + * + * Warning: This function is dangerous, and its use is discouraged. + * The thread can be terminated at any point in its code path. + * Threads can be terminated while modifying data. + * There is no chance for the thread to cleanup after itself, + * unlock any held mutexes, etc. In short, use this function only if absolutely necessary. + */ + QThread::terminate(); + QThread::wait(100); } @@ -573,6 +590,8 @@ void VISU_TimeAnimation::run() qApp->lock(); while (myIsActive) { emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + if(!(myFieldsLst[0].myField)) + break; for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; if (myFrame > 0) {