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
|
// used in populate_vectors
|
||||||
void load_next_frame();
|
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;
|
QFuture<void> frame_loader;
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
QWaitCondition frameAdded;
|
QWaitCondition frameAdded;
|
||||||
|
@ -284,9 +284,11 @@ void AOLayer::start_playback(QString p_image)
|
|||||||
this->kill();
|
this->kill();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
if (frame_loader.isRunning())
|
if (frame_loader.isRunning())
|
||||||
exit_loop = true; // tell the loader to stop, we have a new image to load
|
exit_loop = true; // tell the loader to stop, we have a new image to load
|
||||||
|
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
if (!ao_app->is_continuous_enabled()) {
|
if (!ao_app->is_continuous_enabled()) {
|
||||||
@ -561,13 +563,20 @@ void AOLayer::movie_ticker()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AOLayer::populate_vectors() {
|
void AOLayer::populate_vectors() {
|
||||||
while (!exit_loop && movie_frames.size() < max_frames) {
|
|
||||||
load_next_frame();
|
|
||||||
#ifdef DEBUG_MOVIE
|
#ifdef DEBUG_MOVIE
|
||||||
qDebug() << "[AOLayer::populate_vectors] Loaded frame" << movie_frames.size();
|
qDebug() << "[AOLayer::populate_vectors] Started thread";
|
||||||
#endif
|
#endif
|
||||||
}
|
while (!exit_loop && movie_frames.size() < max_frames) {
|
||||||
exit_loop = false;
|
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() {
|
void AOLayer::load_next_frame() {
|
||||||
|
Loading…
Reference in New Issue
Block a user