gui: user more reliable locking

This commit is contained in:
Miodrag Milanovic 2024-02-29 08:48:04 +01:00 committed by myrtle
parent 465cbfaf19
commit 75af8ccfd2

View File

@ -60,17 +60,12 @@ class PeriodicRunner : public QThread
void run(void) override
{
for (;;) {
mutex_.lock();
QMutexLocker locker(&mutex_);
condition_.wait(&mutex_);
if (abort_) {
mutex_.unlock();
return;
}
target_();
mutex_.unlock();
}
}
@ -78,11 +73,11 @@ class PeriodicRunner : public QThread
~PeriodicRunner()
{
mutex_.lock();
abort_ = true;
condition_.wakeOne();
mutex_.unlock();
{
QMutexLocker locker(&mutex_);
abort_ = true;
condition_.wakeOne();
}
wait();
}