Skip to content

Commit

Permalink
Pass complex object by reference to lambdas
Browse files Browse the repository at this point in the history
IB-7930

Signed-off-by: Mart Somermaa <[email protected]>
  • Loading branch information
mrts committed Mar 22, 2024
1 parent ff1f37f commit 770bd46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ui/webeiddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void WebEidDialog::onMultipleCertificatesReady(
ui->pinInput->clear();
onMultipleCertificatesReady(origin, certificateAndPinInfos);
});
setupOK([this, origin, certificateAndPinInfos] {
setupOK([this, &origin] {
// Authenticate continues with the selected certificate to onSingleCertificateReady().
if (auto* button =
qobject_cast<CertificateButton*>(ui->selectionGroup->checkedButton())) {
Expand Down Expand Up @@ -376,7 +376,7 @@ void WebEidDialog::onSingleCertificateReady(const QUrl& origin,
switch (currentCommand) {
case CommandType::GET_SIGNING_CERTIFICATE:
setupCertificateAndPinInfo({certAndPin});
setupOK([this, certAndPin] { emit accepted(certAndPin); });
setupOK([this, &certAndPin] { emit accepted(certAndPin); });
ui->selectionGroup->buttons().at(0)->click();
ui->pageStack->setCurrentIndex(int(Page::SELECT_CERTIFICATE));
return;
Expand Down Expand Up @@ -541,7 +541,7 @@ void WebEidDialog::setTrText(QWidget* label, Text text) const
void WebEidDialog::connectOkToCachePinAndEmitSelectedCertificate(
const CardCertificateAndPinInfo& certAndPin)
{
setupOK([this, certAndPin = std::forward<const CardCertificateAndPinInfo&>(certAndPin)] {
setupOK([this, &certAndPin] {
ui->pinInput->hide();
ui->pinTitleLabel->hide();
ui->pinErrorLabel->hide();
Expand Down Expand Up @@ -592,7 +592,7 @@ void WebEidDialog::setupPinPrompt(const PinInfo& pinInfo)
ui->pinErrorLabel->setVisible(showPinError);
showPinInputWarning(showPinError);
if (showPinError) {
setTrText(ui->pinErrorLabel, [pinInfo]() -> QString {
setTrText(ui->pinErrorLabel, [&pinInfo]() -> QString {
return tr("The PIN has been entered incorrectly at least once. %n attempts left.",
nullptr, int(pinInfo.pinRetriesCount.first));
});
Expand Down

0 comments on commit 770bd46

Please sign in to comment.