Commit 3a2702bf authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

fix startup initialization of file cleaner

it ran multiple times before because started never was set true, but
more importantly let's just use the call_once idiom here
parent a90b8c7b
Pipeline #259473 passed with stage
in 6 minutes and 31 seconds
......@@ -3,6 +3,8 @@
#include "fileCleaner.h"
#include <mutex>
#include <QScopeGuard>
#include <QThread>
......@@ -27,11 +29,11 @@ FileCleaner *FileCleaner::instance()
threadPtr->wait();
});
static bool started = false;
if (!started) {
static std::once_flag once;
std::call_once(once, [] {
cleaner->moveToThread(&thread);
thread.start(QThread::IdlePriority);
}
});
return cleaner;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment