[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.
This commit is contained in:
Adriaan de Groot 2020-10-31 23:37:06 +01:00
parent 0a44ce381e
commit 4d444cbfbb

View File

@ -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." )