Avoiding segfault in DeleteOperation and ResizeOperation.
This commit is contained in:
parent
1e95d01923
commit
6b0af70ccd
|
@ -128,13 +128,15 @@ bool DeleteOperation::canDelete(const Partition* p, const QList<Operation *> pen
|
||||||
}
|
}
|
||||||
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
||||||
// See if innerFS is LVM
|
// See if innerFS is LVM
|
||||||
FileSystem *fs = static_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
FileSystem *fs = dynamic_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
||||||
|
|
||||||
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
if (fs) {
|
||||||
// See if there is a newly created VG targeting this partition
|
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
||||||
for (Operation *op : qAsConst(pendingOps)) {
|
// See if there is a newly created VG targeting this partition
|
||||||
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
for (Operation *op : qAsConst(pendingOps)) {
|
||||||
return false;
|
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,13 +362,15 @@ bool ResizeOperation::canShrink(const Partition* p, const QList<Operation *> pen
|
||||||
}
|
}
|
||||||
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
||||||
// See if innerFS is LVM
|
// See if innerFS is LVM
|
||||||
FileSystem *fs = static_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
FileSystem *fs = dynamic_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
||||||
|
|
||||||
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
if (fs) {
|
||||||
// See if there is a newly created VG targeting this partition
|
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
||||||
for (Operation *op : qAsConst(pendingOps)) {
|
// See if there is a newly created VG targeting this partition
|
||||||
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
for (Operation *op : qAsConst(pendingOps)) {
|
||||||
return false;
|
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,13 +406,15 @@ bool ResizeOperation::canMove(const Partition* p, const QList<Operation *> pendi
|
||||||
}
|
}
|
||||||
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
||||||
// See if innerFS is LVM
|
// See if innerFS is LVM
|
||||||
FileSystem *fs = static_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
FileSystem *fs = dynamic_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
||||||
|
|
||||||
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
if (fs) {
|
||||||
// See if there is a newly created VG targeting this partition
|
if (fs->type() == FileSystem::Type::Lvm2_PV) {
|
||||||
for (Operation *op : qAsConst(pendingOps)) {
|
// See if there is a newly created VG targeting this partition
|
||||||
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
for (Operation *op : qAsConst(pendingOps)) {
|
||||||
return false;
|
if (dynamic_cast<CreateVolumeGroupOperation *>(op) && op->targets(*p))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue