diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index fd50d48cd..bfc826d99 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -829,10 +829,10 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path) Q_UNUSED(path) if (m_knownMeasurementsDatabase != nullptr) { - m_knownMeasurementsRepopulateWatcher->setFuture( - QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); })); QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher::finished, this, &MApplication::SyncKnownMeasurements); + m_knownMeasurementsRepopulateWatcher->setFuture( + QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); })); } } diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 9adc1981b..9b187303b 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -284,10 +284,10 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool { QEventLoop wait; QFutureWatcher fw; + QObject::connect(&fw, &QFutureWatcher::finished, &wait, &QEventLoop::quit); fw.setFuture( QtConcurrent::run([&lGenerator, timer, nestingState]() { lGenerator.Generate(timer, lGenerator.GetNestingTimeMSecs(), nestingState); })); - QObject::connect(&fw, &QFutureWatcher::finished, &wait, &QEventLoop::quit); wait.exec(); } diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index 2babe3b88..8e357465e 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -235,10 +235,10 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop, return position.getBestResult(); }; - watcher.setFuture(QtConcurrent::mapped(jobs, Nest)); - QEventLoop wait; QObject::connect(&watcher, &QFutureWatcher::finished, &wait, &QEventLoop::quit); + + watcher.setFuture(QtConcurrent::mapped(jobs, Nest)); wait.exec(); if (stop->load())