diff --git a/src/app/puzzle/layout/vpsheet.cpp b/src/app/puzzle/layout/vpsheet.cpp index dd99d29b3..45a322358 100644 --- a/src/app/puzzle/layout/vpsheet.cpp +++ b/src/app/puzzle/layout/vpsheet.cpp @@ -548,6 +548,12 @@ VPSheet::VPSheet(const VPLayoutPtr &layout, QObject *parent) SetSheetMargins(settings->GetLayoutSheetMargins()); SetSheetSize(QSizeF(settings->GetLayoutSheetPaperWidth(), settings->GetLayoutSheetPaperHeight())); + connect(qApp, &QCoreApplication::aboutToQuit, m_validityWatcher, + [this]() + { + m_validityWatcher->cancel(); + m_validityWatcher->waitForFinished(); + }); connect(m_validityWatcher, &QFutureWatcher>::finished, this, &VPSheet::UpdatePiecesValidity); } @@ -844,6 +850,11 @@ void VPSheet::CheckPiecesPositionValidity() const //--------------------------------------------------------------------------------------------------------------------- void VPSheet::UpdatePiecesValidity() { + if (m_validityWatcher->isCanceled()) + { + return; + } + QHash const newValidations = m_validityWatcher->future().result(); QList const pieces = GetPieces(); diff --git a/src/app/share/collection/jacketM6_30-110.val b/src/app/share/collection/jacketM6_30-110.val index a4b44972a..fca18d1e0 100644 --- a/src/app/share/collection/jacketM6_30-110.val +++ b/src/app/share/collection/jacketM6_30-110.val @@ -187,7 +187,7 @@ - + @@ -196,9 +196,9 @@ - - - + + + @@ -209,9 +209,9 @@ - - - + + + @@ -221,7 +221,7 @@ - + @@ -304,7 +304,7 @@
- + @@ -378,9 +378,9 @@
- - - + + + diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 1dfa2fa13..96787a142 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -883,10 +883,24 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path) Q_UNUSED(path) if (m_knownMeasurementsDatabase != nullptr) { + connect(qApp, &QCoreApplication::aboutToQuit, m_knownMeasurementsRepopulateWatcher, + [this]() + { + m_knownMeasurementsRepopulateWatcher->cancel(); + m_knownMeasurementsRepopulateWatcher->waitForFinished(); + }); QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher::finished, this, &MApplication::SyncKnownMeasurements); - m_knownMeasurementsRepopulateWatcher->setFuture( - QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); })); + m_knownMeasurementsRepopulateWatcher->setFuture(QtConcurrent::run( + [this]() + { + if (m_knownMeasurementsRepopulateWatcher->isCanceled()) + { + return; + } + + m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); + })); } } diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 29f0545fe..99850cfdf 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -285,6 +285,12 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool { QEventLoop wait; QFutureWatcher fw; + connect(qApp, &QCoreApplication::aboutToQuit, &fw, + [&fw]() + { + fw.cancel(); + fw.waitForFinished(); + }); QObject::connect(&fw, &QFutureWatcher::finished, &wait, &QEventLoop::quit); fw.setFuture( QtConcurrent::run([&lGenerator, timer, nestingState]() diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index eb6b95130..a5db73660 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -276,6 +276,12 @@ VDomDocument::VDomDocument(QObject *parent) m_elementIdCache(), m_watcher(new QFutureWatcher>(this)) { + connect(qApp, &QCoreApplication::aboutToQuit, m_watcher, + [this]() + { + m_watcher->cancel(); + m_watcher->waitForFinished(); + }); connect(m_watcher, &QFutureWatcher>::finished, this, &VDomDocument::CacheRefreshed); } @@ -724,6 +730,11 @@ auto VDomDocument::Compare(const QDomElement &element1, const QDomElement &eleme //--------------------------------------------------------------------------------------------------------------------- void VDomDocument::CacheRefreshed() { + if (m_watcher->isCanceled()) + { + return; + } + m_elementIdCache = m_watcher->future().result(); } diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 26a8b3581..f92924a0c 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1729,9 +1729,20 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat m_foldLineMark->setBrush(Qt::SolidPattern); + connect(qApp, &QCoreApplication::aboutToQuit, m_patternUpdateInfoWatcher, + [this]() + { + m_patternUpdateInfoWatcher->cancel(); + m_patternUpdateInfoWatcher->waitForFinished(); + }); connect(m_patternUpdateInfoWatcher, &QFutureWatcher::finished, this, [this]() { + if (m_patternUpdateInfoWatcher->isCanceled()) + { + return; + } + setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); m_patternInfo->show(); UpdateLabelItem(m_patternInfo, m_patternLabelPos, m_patternLabelAngle); @@ -1742,9 +1753,20 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat UpdatePatternInfo(); } }); + connect(qApp, &QCoreApplication::aboutToQuit, m_pieceUpdateInfoWatcher, + [this]() + { + m_pieceUpdateInfoWatcher->cancel(); + m_pieceUpdateInfoWatcher->waitForFinished(); + }); connect(m_pieceUpdateInfoWatcher, &QFutureWatcher::finished, this, [this]() { + if (m_pieceUpdateInfoWatcher->isCanceled()) + { + return; + } + setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); m_dataLabel->show(); UpdateLabelItem(m_dataLabel, m_pieceLabelPos, m_pieceLabelAngle);