From 4d444cbfbb1b09efea32ee1b5432bfc3d1d9893b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 31 Oct 2020 23:37:06 +0100 Subject: [PATCH] [partition] Reduce warnings (Clang, FreeBSD) The code doesn't match the comment: there are no by-ref captures in the code, and the shadowing of parameters and local variables is confusing. Remove one variable that is passed in as an argument (and just pass the value as argument) and copy-capture the other rather than doing weird argument passing. --- src/modules/partition/gui/ChoicePage.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 2b68cafe7..35aec51e4 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -736,14 +736,12 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) return; } + // This will be deleted by the second lambda, below. QString* homePartitionPath = new QString(); - bool doReuseHomePartition = m_reuseHomeCheckBox->isChecked(); - // NOTE: using by-ref captures because we need to write homePartitionPath and - // doReuseHomePartition *after* the device revert, for later use. ScanningDialog::run( QtConcurrent::run( - [this, current]( QString* homePartitionPath, bool doReuseHomePartition ) { + [this, current, homePartitionPath]( bool doReuseHomePartition ) { QMutexLocker locker( &m_coreMutex ); if ( m_core->isDirty() ) @@ -823,9 +821,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) } } }, - homePartitionPath, - doReuseHomePartition ), - [=] { + m_reuseHomeCheckBox->isChecked() ), + [this, homePartitionPath] { m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() ); if ( !homePartitionPath->isEmpty() ) m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )