aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorin1tiate <radwoodward@vikings.grayson.edu>2021-08-11 20:14:35 -0500
committerin1tiate <radwoodward@vikings.grayson.edu>2021-08-11 20:14:35 -0500
commit2a18c1cdec54a324c6ba9834d6e6b05cc46f2535 (patch)
treea4ae3a0aa2c64c49427ebe5f4ba685ec24bd6ab6
parent42760bc3f86e1d38acbf6c3c9f675dbf6acc37c8 (diff)
wait for thread to finish before starting new one
-rw-r--r--include/aolayer.h3
-rw-r--r--src/aolayer.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/include/aolayer.h b/include/aolayer.h
index 1216b324..ffbd6dac 100644
--- a/include/aolayer.h
+++ b/include/aolayer.h
@@ -143,6 +143,9 @@ protected:
// Populates the frame and delay vectors with the next frame's data.
void load_next_frame();
+ // used in load_next_frame
+ QFuture<void> future;
+
signals:
void done();
diff --git a/src/aolayer.cpp b/src/aolayer.cpp
index 25873fee..99524947 100644
--- a/src/aolayer.cpp
+++ b/src/aolayer.cpp
@@ -529,8 +529,8 @@ void CharLayer::movie_ticker()
void AOLayer::movie_ticker()
{
++frame;
- QFuture<void> future;
if (frame >= movie_frames.size() && frame < max_frames) { // need to load the image
+ future.waitForFinished(); // Do Not want this to be running twice
future = QtConcurrent::run(this, &AOLayer::load_next_frame);
}
else if (frame >= max_frames) {