aboutsummaryrefslogtreecommitdiff
path: root/src/aolayer.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2022-01-08 12:55:10 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2022-01-08 12:55:10 -0600
commitba08ec0379fcbe3c62f1d209bd924de129d0f523 (patch)
tree7a94b361c861e2fb2f257ae4301dd18dc38fdee0 /src/aolayer.cpp
parent3ec3d3a1217842ef72d8326b6803af70b3f3caa9 (diff)
Fix more race conditions in AOLayer loading
- Uninitialized exit_loop variable - Previous load task should stop completely before starting new load task
Diffstat (limited to 'src/aolayer.cpp')
-rw-r--r--src/aolayer.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/aolayer.cpp b/src/aolayer.cpp
index 7c899714..a5e1d9bd 100644
--- a/src/aolayer.cpp
+++ b/src/aolayer.cpp
@@ -284,9 +284,11 @@ void AOLayer::start_playback(QString p_image)
this->kill();
return;
}
- QMutexLocker locker(&mutex);
+
if (frame_loader.isRunning())
exit_loop = true; // tell the loader to stop, we have a new image to load
+
+ QMutexLocker locker(&mutex);
this->show();
if (!ao_app->is_continuous_enabled()) {
@@ -561,13 +563,20 @@ void AOLayer::movie_ticker()
}
void AOLayer::populate_vectors() {
- while (!exit_loop && movie_frames.size() < max_frames) {
- load_next_frame();
#ifdef DEBUG_MOVIE
- qDebug() << "[AOLayer::populate_vectors] Loaded frame" << movie_frames.size();
+ qDebug() << "[AOLayer::populate_vectors] Started thread";
#endif
- }
- exit_loop = false;
+ while (!exit_loop && movie_frames.size() < max_frames) {
+ load_next_frame();
+#ifdef DEBUG_MOVIE
+ qDebug() << "[AOLayer::populate_vectors] Loaded frame" << movie_frames.size();
+#endif
+ }
+#ifdef DEBUG_MOVIE
+ if (exit_loop)
+ qDebug() << "[AOLayer::populate_vectors] Exit requested";
+#endif
+ exit_loop = false;
}
void AOLayer::load_next_frame() {