Layout stops after timeout too slow.
--HG-- branch : develop
This commit is contained in:
parent
ea75af2f46
commit
95d6bceb9b
|
@ -103,7 +103,26 @@ int VLayoutGenerator::DetailsCount()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutGenerator::Generate(const QElapsedTimer &timer, qint64 timeout, LayoutErrors previousState)
|
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();
|
papers.clear();
|
||||||
bank->Reset();
|
bank->Reset();
|
||||||
state = previousState;
|
state = previousState;
|
||||||
|
@ -111,19 +130,6 @@ void VLayoutGenerator::Generate(const QElapsedTimer &timer, qint64 timeout, Layo
|
||||||
int width = PageWidth();
|
int width = PageWidth();
|
||||||
int height = PageHeight();
|
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 (VFuzzyComparePossibleNulls(shift, -1))
|
||||||
{
|
{
|
||||||
if (bank->PrepareDetails())
|
if (bank->PrepareDetails())
|
||||||
|
@ -333,7 +339,6 @@ void VLayoutGenerator::Abort()
|
||||||
{
|
{
|
||||||
stopGeneration.store(true);
|
stopGeneration.store(true);
|
||||||
state = LayoutErrors::ProcessStoped;
|
state = LayoutErrors::ProcessStoped;
|
||||||
QThreadPool::globalInstance()->clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -344,7 +349,6 @@ void VLayoutGenerator::Timeout()
|
||||||
{
|
{
|
||||||
state = LayoutErrors::Timeout;
|
state = LayoutErrors::Timeout;
|
||||||
}
|
}
|
||||||
QThreadPool::globalInstance()->clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user