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