prevent race condition when aborting calibration measurement

This commit is contained in:
Jan Käberich 2025-02-27 19:59:52 +01:00
parent 28150307ca
commit 86fbe929d4
2 changed files with 6 additions and 1 deletions

View file

@ -607,6 +607,7 @@ void LibreCALDialog::startCalibration()
connect(cal, &Calibration::measurementsUpdated, this, startNextCalibrationStep, Qt::QueuedConnection);
connect(cal, &Calibration::measurementsAborted, this, [=](){
enableUI();
ui->lCalibrationStatus->setText("Ready to start");
});
startNextCalibrationStep();

View file

@ -168,7 +168,11 @@ VNA::VNA(AppWindow *window, QString name)
// A modal QProgressDialog calls processEvents() in setValue(). Needs to use a queued connection to update the progress
// value from within the NewDatapoint slot to prevent possible re-entrancy.
connect(this, &VNA::calibrationMeasurementPercentage, calDialog, &QProgressDialog::setValue, Qt::QueuedConnection);
connect(this, &VNA::calibrationMeasurementPercentage, calDialog, [=](int percent) {
if(calMeasuring || percent == 100) {
calDialog->setValue(percent);
}
}, Qt::QueuedConnection);
connect(calDialog, &QProgressDialog::canceled, this, [=]() {
// the user aborted the calibration measurement