backport r1115229 to branches/1.0

CCBUG:232092

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1115230
This commit is contained in:
Volker Lanz 2010-04-15 17:38:22 +00:00
parent bde6a18f68
commit 4f4712f52f
1 changed files with 11 additions and 4 deletions

View File

@ -63,11 +63,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>
@ -95,7 +97,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.");
@ -109,8 +111,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());