Fix more race conditions in AOLayer loading
- Uninitialized exit_loop variable - Previous load task should stop completely before starting new load task
This commit is contained in:
parent
3ec3d3a121
commit
ba08ec0379
@ -148,7 +148,7 @@ private:
|
||||
|
||||
// used in populate_vectors
|
||||
void load_next_frame();
|
||||
std::atomic_bool exit_loop; //awful solution but i'm not fucking using QThread
|
||||
std::atomic_bool exit_loop = false; //awful solution but i'm not fucking using QThread
|
||||
QFuture<void> frame_loader;
|
||||
QMutex mutex;
|
||||
QWaitCondition frameAdded;
|
||||
|
@ -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,12 +563,19 @@ void AOLayer::movie_ticker()
|
||||
}
|
||||
|
||||
void AOLayer::populate_vectors() {
|
||||
#ifdef DEBUG_MOVIE
|
||||
qDebug() << "[AOLayer::populate_vectors] Started thread";
|
||||
#endif
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user