clear the clipboard if undo deleted the partition that's in it

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1129877
This commit is contained in:
Volker Lanz 2010-05-24 01:52:36 +00:00
parent 15e23d806e
commit 51ae5ddcb4
1 changed files with 6 additions and 0 deletions

View File

@ -724,6 +724,12 @@ void MainWindow::onUndoOperation()
Log() << i18nc("@info/plain", "Undoing operation: %1", operationStack().operations().last()->description());
operationStack().pop();
// it's possible the undo killed the partition in the clipboard. if there's a partition in the clipboard, try
// to find a device for it (OperationStack::findDeviceForPartition() only compares pointers, so an invalid
// pointer is not a problem). if no device is found, the pointer must be dangling, so clear the clipboard.
if (pmWidget().clipboardPartition() != NULL && operationStack().findDeviceForPartition(pmWidget().clipboardPartition()) == NULL)
pmWidget().setClipboardPartition(NULL);
pmWidget().updatePartitions();
enableActions();
}