diff --git a/src/core/partition.cpp b/src/core/partition.cpp index 678d3b2..02838c3 100644 --- a/src/core/partition.cpp +++ b/src/core/partition.cpp @@ -29,12 +29,12 @@ #include "util/report.h" #include +#include #include #include #include #include -#include /** Creates a new Partition object. @param parent the Partition's parent. May be another Partition (for logicals) or a PartitionTable. Must not be nullptr. @@ -326,17 +326,18 @@ bool Partition::unmount(Report& report) if (!isMounted()) return false; - bool success = true; + bool success = false; - while (success) { - if (fileSystem().canUnmount(deviceNode())) { - success = fileSystem().unmount(report, deviceNode()); - } + if (fileSystem().canUnmount(deviceNode())) { + success = fileSystem().unmount(report, deviceNode()); + } - KMountPoint::List mountPoints = KMountPoint::currentMountPoints(KMountPoint::NeedRealDeviceName); - - if (!mountPoints.findByDevice(deviceNode())) + const QList mountedVolumes = QStorageInfo::mountedVolumes(); + for (const QStorageInfo &storage : QStorageInfo::mountedVolumes()) { + if (QString::fromUtf8(storage.device()) == deviceNode() ) { + success = false; break; + } } setMounted(!success);