Fix regression. Changing dimension value caused an infinite loop.

This commit is contained in:
Roman Telezhynskyi 2021-01-27 19:20:26 +02:00
parent e714999430
commit 63aba8728b
2 changed files with 33 additions and 19 deletions

View File

@ -1,5 +1,6 @@
# Version 0.7.43 (unreleased) # Version 0.7.43 (unreleased)
- Improve Windows installer. Avoid crashing on checking if a program is still running. - Improve Windows installer. Avoid crashing on checking if a program is still running.
- Fix regression. Changing dimension value caused an infinite loop.
# Version 0.7.42 Jan 26, 2021 # Version 0.7.42 Jan 26, 2021
- Fix export of pattern recipe. - Fix export of pattern recipe.

View File

@ -3831,45 +3831,58 @@ void MainWindow::PatternChangesWereSaved(bool saved)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::DimensionABaseChanged() void MainWindow::DimensionABaseChanged()
{ {
const qreal oldValue = m_currentDimensionA;
m_currentDimensionA = dimensionA->currentData().toDouble(); m_currentDimensionA = dimensionA->currentData().toDouble();
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values(); if (not VFuzzyComparePossibleNulls(oldValue, m_currentDimensionA))
if (dimensions.size() > 1)
{ {
MeasurementDimension_p dimension = dimensions.at(1); const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
InitDimensionGradation(1, dimension, dimensionB); if (dimensions.size() > 1)
if (dimensions.size() > 2)
{ {
dimension = dimensions.at(2); MeasurementDimension_p dimension = dimensions.at(1);
InitDimensionGradation(2, dimension, dimensionC); InitDimensionGradation(1, dimension, dimensionB);
}
}
m_gradation->start(); if (dimensions.size() > 2)
{
dimension = dimensions.at(2);
InitDimensionGradation(2, dimension, dimensionC);
}
}
m_gradation->start();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::DimensionBBaseChanged() void MainWindow::DimensionBBaseChanged()
{ {
const qreal oldValue = m_currentDimensionB;
m_currentDimensionB = dimensionB->currentData().toDouble(); m_currentDimensionB = dimensionB->currentData().toDouble();
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values(); if (not VFuzzyComparePossibleNulls(oldValue, m_currentDimensionB))
if (dimensions.size() > 2)
{ {
MeasurementDimension_p dimension = dimensions.at(2); const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
InitDimensionGradation(2, dimension, dimensionC);
}
m_gradation->start(); if (dimensions.size() > 2)
{
const MeasurementDimension_p& dimension = dimensions.at(2);
InitDimensionGradation(2, dimension, dimensionC);
}
m_gradation->start();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::DimensionCBaseChanged() void MainWindow::DimensionCBaseChanged()
{ {
const qreal oldValue = m_currentDimensionC;
m_currentDimensionC = dimensionC->currentData().toDouble(); m_currentDimensionC = dimensionC->currentData().toDouble();
m_gradation->start();
if (not VFuzzyComparePossibleNulls(oldValue, m_currentDimensionC))
{
m_gradation->start();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------