Skip to content

Commit

Permalink
bugfix: prevent occasional crash after loading coefficients
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Sep 26, 2024
1 parent e78d226 commit f4f642a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Software/LibreCAL-GUI/appwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ AppWindow::AppWindow() :
});
connect(ui->coeffList, &QListWidget::currentRowChanged, [=](int row){
if(device) {
if(row < (int) device->getCoefficientSets().size()) {
if(row >= 0 && row < (int) device->getCoefficientSets().size()) {
showCoefficientSet(device->getCoefficientSets()[row]);
}
}
Expand Down Expand Up @@ -361,11 +361,11 @@ void AppWindow::loadCoefficients()
d->setWindowModality(Qt::ApplicationModal);
d->setMinimumDuration(0);
d->setCancelButton(nullptr);
connect(device, &CalDevice::updateCoefficientsPercent, d, &QProgressDialog::setValue);
connect(device, &CalDevice::updateCoefficientsPercent, d, &QProgressDialog::setValue, Qt::DirectConnection);
connect(device, &CalDevice::updateCoefficientsDone, d, [=](){
d->accept();
delete d;
});
}, Qt::QueuedConnection);
connect(device, &CalDevice::updateCoefficientsDone, this, [=](){
ui->saveCoefficients->setEnabled(false);
backgroundOperations = false;
Expand Down Expand Up @@ -397,11 +397,11 @@ void AppWindow::saveCoefficients()
d->setWindowModality(Qt::ApplicationModal);
d->setMinimumDuration(0);
d->setCancelButton(nullptr);
connect(device, &CalDevice::updateCoefficientsPercent, d, &QProgressDialog::setValue);
connect(device, &CalDevice::updateCoefficientsPercent, d, &QProgressDialog::setValue, Qt::DirectConnection);
connect(device, &CalDevice::updateCoefficientsDone, d, [=](){
d->accept();
delete d;
});
}, Qt::QueuedConnection);
connect(device, &CalDevice::updateCoefficientsDone, d, [=](){
ui->saveCoefficients->setEnabled(device->hasModifiedCoefficients());
backgroundOperations = false;
Expand Down

0 comments on commit f4f642a

Please sign in to comment.