diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index 27c0c000..110a4aa1 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -244,7 +244,7 @@ PageLoader::~PageLoader() bool PageLoader::busy() const { - return isRunning() ? working : false; + return isRunning() ? working.load() : false; } void PageLoader::generate(int index, QSize size, const QByteArray &rImage) @@ -283,8 +283,8 @@ void PageLoader::run() mutex->unlock(); mutex->lock(); - this->working = false; this->img = image; + this->working = false; mutex->unlock(); // put to sleep diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index d119e8b5..09fe2ce0 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -9,6 +9,8 @@ #include #include +#include + class QLineEdit; class QPushButton; class QPixmap; @@ -89,7 +91,7 @@ private: QWaitCondition condition; bool restart; - bool working; + std::atomic working; int idx; QSize size;