Handle parent change in Partition copy constructor.
This commit is contained in:
parent
2e960d5c00
commit
a749d1c84d
|
@ -90,7 +90,7 @@ Partition::~Partition()
|
||||||
|
|
||||||
/** @param other Partition to copy
|
/** @param other Partition to copy
|
||||||
*/
|
*/
|
||||||
Partition::Partition(const Partition& other) :
|
Partition::Partition(const Partition& other, PartitionNode* parent) :
|
||||||
PartitionNode(),
|
PartitionNode(),
|
||||||
m_Children(),
|
m_Children(),
|
||||||
m_Parent(other.m_Parent),
|
m_Parent(other.m_Parent),
|
||||||
|
@ -106,10 +106,12 @@ Partition::Partition(const Partition& other) :
|
||||||
m_SectorSize(other.m_SectorSize),
|
m_SectorSize(other.m_SectorSize),
|
||||||
m_State(other.m_State)
|
m_State(other.m_State)
|
||||||
{
|
{
|
||||||
|
if ( parent )
|
||||||
|
m_Parent = parent;
|
||||||
|
|
||||||
setPartitionPath(other.m_PartitionPath);
|
setPartitionPath(other.m_PartitionPath);
|
||||||
for (const auto &child : other.children()) {
|
for (const auto &child : other.children()) {
|
||||||
Partition* p = new Partition(*child);
|
Partition* p = new Partition(*child, this);
|
||||||
p->setParent(this);
|
|
||||||
m_Children.append(p);
|
m_Children.append(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
Partition(PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem* fs, qint64 sectorStart, qint64 sectorEnd, QString partitionPath, PartitionTable::Flags availableFlags = PartitionTable::FlagNone, const QString& mountPoint = QString(), bool mounted = false, PartitionTable::Flags activeFlags = PartitionTable::FlagNone, State state = StateNone);
|
Partition(PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem* fs, qint64 sectorStart, qint64 sectorEnd, QString partitionPath, PartitionTable::Flags availableFlags = PartitionTable::FlagNone, const QString& mountPoint = QString(), bool mounted = false, PartitionTable::Flags activeFlags = PartitionTable::FlagNone, State state = StateNone);
|
||||||
~Partition();
|
~Partition();
|
||||||
|
|
||||||
Partition(const Partition&);
|
Partition(const Partition& other, PartitionNode* parent = nullptr);
|
||||||
Partition& operator=(const Partition&);
|
Partition& operator=(const Partition&);
|
||||||
|
|
||||||
bool operator==(const Partition& other) const;
|
bool operator==(const Partition& other) const;
|
||||||
|
|
|
@ -63,7 +63,7 @@ PartitionTable::PartitionTable(const PartitionTable& other)
|
||||||
for (Partitions::const_iterator it = other.m_Children.constBegin();
|
for (Partitions::const_iterator it = other.m_Children.constBegin();
|
||||||
it != other.m_Children.constEnd(); ++it)
|
it != other.m_Children.constEnd(); ++it)
|
||||||
{
|
{
|
||||||
m_Children.append(new Partition(**it));
|
m_Children.append(new Partition(**it, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue