Do not merge resize/new/delete ops if an extended partition is involved: Too

many things can go wrong, all of them leading to crashes.

BUG:232092

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1115229
This commit is contained in:
Volker Lanz 2010-04-15 17:34:34 +00:00
parent 34842c84cb
commit 067eeb018d
2 changed files with 11 additions and 8 deletions

4
TODO
View File

@ -15,10 +15,6 @@ Bugs to fix for 1.1:
* copy&paste seems broken wrt alignment when copying from cylinder aligned to
sector aligned drives (maybe even more than that)
* resizing a newly created extended that has children (leading to a merge of
operations) crashes in NewOperation::description(). this is intermittent
and probably fixed in r1107315.
* make sure the default file system can indeed be created
===============================================================================

View File

@ -67,11 +67,13 @@ OperationStack::~OperationStack()
<ol>
<!-- 1 -->
<li>An existing operation created a Partition that is now being deleted: In this case, just remove
the corresponding NewOperation from the OperationStack.</li>
the corresponding NewOperation from the OperationStack.<br/>This does not work for
extended partitions.(#232092)</li>
<!-- 2 -->
<li>An existing Operation created a Partition that is now being moved or resized. In this case,
remove the original NewOperation and create a new NewOperation with updated start and end
sectors. This new NewOperation is appended to the OperationStack.</li>
sectors. This new NewOperation is appended to the OperationStack.<br/>This does not work for
extended partitions.(#232092)</li>
<!-- 3 -->
<li>An existing NewOperation created a Partition that is now being copied. We're not copying
but instead creating another new Partition in its place.</li>
@ -99,7 +101,7 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
CreateFileSystemOperation* pushedCreateFileSystemOp = dynamic_cast<CreateFileSystemOperation*>(pushedOp);
// -- 1 --
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition())
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended))
{
Log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition.");
@ -113,8 +115,13 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
}
// -- 2 --
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition())
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() && !pushedResizeOp->partition().roles().has(PartitionRole::Extended))
{
// NOTE: In theory it would be possible to merge resizing an extended as long as it has no children.
// But that still doesn't save us: If we're not merging a resize on an extended that has children,
// a resizeop is added to the stack. Next, the user deletes the child. Then he resizes the
// extended again (a second resize): The ResizeOp still has the pointer to the original extended that
// will now be deleted.
Log() << i18nc("@info/plain", "Resizing a partition just created: Updating start and end in existing operation.");
Partition* newPartition = new Partition(newOp->newPartition());