Qt: fix futurewatcher cancel

This commit is contained in:
Megamouse 2023-04-27 00:51:21 +02:00
parent eb5ea82bb1
commit 1a07f40c4b

View file

@ -133,8 +133,10 @@ namespace gui
template <typename T> template <typename T>
void stop_future_watcher(QFutureWatcher<T>& watcher, bool cancel, std::shared_ptr<atomic_t<bool>> cancel_flag = nullptr) void stop_future_watcher(QFutureWatcher<T>& watcher, bool cancel, std::shared_ptr<atomic_t<bool>> cancel_flag = nullptr)
{ {
if (watcher.isStarted() || watcher.isRunning()) if (watcher.isPaused() || watcher.isRunning())
{ {
watcher.resume();
if (cancel) if (cancel)
{ {
watcher.cancel(); watcher.cancel();