Adding PVs that are member of VGs that are going to be deleted soon in CreateVolumeGroupDialog and ResizeVolumeGroupDialog. Avoiding segfault because of devices partition tables in CreateVolumeGroupDialog and ResizeVolumeGroupDialog.

This commit is contained in:
Caio Carvalho 2018-07-23 13:38:30 -03:00
parent 9bcde2c7de
commit f21b42d10e
2 changed files with 38 additions and 26 deletions

View File

@ -76,6 +76,7 @@ void CreateVolumeGroupDialog::setupDialog()
}
for (const Device *d : qAsConst(m_Devices)) {
if (d->partitionTable() != nullptr) {
for (const Partition *p : qAsConst(d->partitionTable()->children())) {
// Looking if there is another VG creation that contains this partition
if (LvmDevice::s_DirtyPVs.contains(p))
@ -94,6 +95,11 @@ void CreateVolumeGroupDialog::setupDialog()
}
}
}
}
for (const Partition *p : qAsConst(LvmDevice::s_OrphanPVs))
if (!LvmDevice::s_DirtyPVs.contains(p))
dialogWidget().listPV().addPartition(*p, false);
}
void CreateVolumeGroupDialog::setupConnections()

View File

@ -78,6 +78,7 @@ void ResizeVolumeGroupDialog::setupDialog()
}
for (const Device *d : qAsConst(m_Devices)) {
if (d->partitionTable() != nullptr) {
for (const Partition *p : qAsConst(d->partitionTable()->children())) {
// Looking if there is another VG creation that contains this partition
if (LvmDevice::s_DirtyPVs.contains(p))
@ -98,6 +99,11 @@ void ResizeVolumeGroupDialog::setupDialog()
}
}
for (const Partition *p : qAsConst(LvmDevice::s_OrphanPVs))
if (!LvmDevice::s_DirtyPVs.contains(p))
dialogWidget().listPV().addPartition(*p, false);
}
//update used size and LV infos
qint32 totalLV = 0;
LvmDevice *lvmDevice = dynamic_cast<LvmDevice *>(device());