From 3e7e9d89551dc44ff008e40d821ca0d832feea43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 21 Dec 2017 23:16:12 +0000 Subject: [PATCH] Sort partitions by first sector. --- src/core/partition.h | 1 + src/core/partitiontable.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/partition.h b/src/core/partition.h index 91edd3f..31da284 100644 --- a/src/core/partition.h +++ b/src/core/partition.h @@ -213,6 +213,7 @@ public: void append(Partition* p) override { m_Children.append(p); + std::sort(m_Children.begin(), m_Children.end(), [] (const Partition *a, const Partition *b) -> bool {return a->firstSector() < b->firstSector();}); } void setDevicePath(const QString& s) { m_DevicePath = s; diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp index 1c816ed..98c1d06 100644 --- a/src/core/partitiontable.cpp +++ b/src/core/partitiontable.cpp @@ -173,6 +173,7 @@ int PartitionTable::numPrimaries() const void PartitionTable::append(Partition* partition) { children().append(partition); + std::sort(children().begin(), children().end(), [] (const Partition *a, const Partition *b) -> bool {return a->firstSector() < b->firstSector();}); } /** @param f the flag to get the name for