From ee72adcfb5288c38ac2eaa9889c63c289f3625eb Mon Sep 17 00:00:00 2001
From: Philip <philm@manjaro.org>
Date: Sat, 12 May 2018 10:05:34 +0200
Subject: [PATCH] [partition] Only bootloader model should ignore devices that
 are not of Disk_Device type #950

---
 src/modules/partition/core/DeviceList.cpp          |  7 +------
 src/modules/partition/core/PartitionCoreModule.cpp | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp
index 3695193b4d..d7e6bab299 100644
--- a/src/modules/partition/core/DeviceList.cpp
+++ b/src/modules/partition/core/DeviceList.cpp
@@ -129,12 +129,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
 
     // Remove the device which contains / from the list
     for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
-        if ( (*it)->type() != Device::Type::Disk_Device )
-        {
-            cDebug() << " .. Removing device that is not a Disk_Device from list " << it;
-            it = erase(devices, it );
-        }
-        else if ( ! ( *it ) ||
+        if ( ! ( *it ) ||
                 ( *it )->deviceNode().startsWith( "/dev/zram" )
         )
         {
diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp
index 178860e2e4..793686b2a8 100644
--- a/src/modules/partition/core/PartitionCoreModule.cpp
+++ b/src/modules/partition/core/PartitionCoreModule.cpp
@@ -164,7 +164,18 @@ PartitionCoreModule::doInit()
     for ( auto deviceInfo : m_deviceInfos )
         deviceInfo->partitionModel->init( deviceInfo->device.data(), m_osproberLines );
 
-    m_bootLoaderModel->init( devices );
+    DeviceList bootLoaderDevices;
+
+    for ( DeviceList::Iterator it = devices.begin(); it != devices.end(); ++it)
+        if ( (*it)->type() != Device::Type::Disk_Device )
+        {
+            cDebug() << "Ignoring device that is not Disk_Device to bootLoaderDevices list.";
+            continue;
+        }
+        else
+            bootLoaderDevices.append(*it);
+
+    m_bootLoaderModel->init( bootLoaderDevices );
 
     //FIXME: this should be removed in favor of
     //       proper KPM support for EFI
-- 
GitLab