diff --git a/src/libs/vlayout/vlayoutgenerator.cpp b/src/libs/vlayout/vlayoutgenerator.cpp index c7e113c6b..faf6158dc 100644 --- a/src/libs/vlayout/vlayoutgenerator.cpp +++ b/src/libs/vlayout/vlayoutgenerator.cpp @@ -103,7 +103,26 @@ int VLayoutGenerator::DetailsCount() //--------------------------------------------------------------------------------------------------------------------- void VLayoutGenerator::Generate(const QElapsedTimer &timer, qint64 timeout, LayoutErrors previousState) { - stopGeneration.store(false); + auto HasExpired = [this, timer, timeout]() + { + if (timer.hasExpired(timeout)) + { + Timeout(); + return true; + } + return false; + }; + + if (HasExpired()) + { + return; + } + + if (state != LayoutErrors::Timeout) + { + stopGeneration.store(false); + } + papers.clear(); bank->Reset(); state = previousState; @@ -111,19 +130,6 @@ void VLayoutGenerator::Generate(const QElapsedTimer &timer, qint64 timeout, Layo int width = PageWidth(); int height = PageHeight(); - auto HasExpired = [this, timer, timeout]() - { - if (timer.hasExpired(timeout)) - { - if (state == LayoutErrors::NoError) - { - state = LayoutErrors::Timeout; - } - return true; - } - return false; - }; - if (VFuzzyComparePossibleNulls(shift, -1)) { if (bank->PrepareDetails()) @@ -333,7 +339,6 @@ void VLayoutGenerator::Abort() { stopGeneration.store(true); state = LayoutErrors::ProcessStoped; - QThreadPool::globalInstance()->clear(); } //--------------------------------------------------------------------------------------------------------------------- @@ -344,7 +349,6 @@ void VLayoutGenerator::Timeout() { state = LayoutErrors::Timeout; } - QThreadPool::globalInstance()->clear(); } //---------------------------------------------------------------------------------------------------------------------