From 3fd221f7941dc6fd7f6c66e5a73c28bc36fb50fa Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Sun, 15 Jul 2018 16:36:43 -0300 Subject: [PATCH] Ranged-for in availableInConf const copy. All the scanned devices should be added to devices list. --- src/core/raid/softwareraid.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/core/raid/softwareraid.cpp b/src/core/raid/softwareraid.cpp index b919479..c7c9c42 100644 --- a/src/core/raid/softwareraid.cpp +++ b/src/core/raid/softwareraid.cpp @@ -194,18 +194,13 @@ void SoftwareRAID::scanSoftwareRAID(QList& devices) SoftwareRAID* d = static_cast(CoreBackendManager::self()->backend()->scanDevice(deviceNode)); - bool isInConf = false; + const QStringList constAvailableInConf = availableInConf; - for (const QString& path : qAsConst(availableInConf)) { - if (getUUID(QStringLiteral("/dev/") + path) == d->uuid()) { - isInConf = true; + for (const QString& path : constAvailableInConf) + if (getUUID(QStringLiteral("/dev/") + path) == d->uuid()) availableInConf.removeAll(path); - break; - } - } - if (isInConf) - devices << d; + devices << d; if (status == QStringLiteral("inactive")) d->setStatus(SoftwareRAID::Status::Inactive);