do not capture by default all values in lambdas

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-10-30 17:55:02 +02:00
parent e7ff3146fe
commit 82bffabb69
38 changed files with 170 additions and 186 deletions

View File

@ -148,10 +148,14 @@ void ResourceDownloadDialog::confirm()
QStringList depNames;
if (auto task = getModDependenciesTask(); task) {
connect(task.get(), &Task::failed, this,
[&](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
[this](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
connect(task.get(), &Task::succeeded, this, [&]() {
QStringList warnings = task->warnings();
auto weak = task.toWeakRef();
connect(task.get(), &Task::succeeded, this, [this, weak]() {
QStringList warnings;
if (auto task = weak.lock()) {
warnings = task->warnings();
}
if (warnings.count()) {
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->exec();
}