Modified Undo() and Redo() to throw an error if there is a transaction

on the Do stack.
This commit is contained in:
kin%netscape.com 1998-12-09 19:53:31 +00:00
Родитель bf5fd6f312
Коммит 962ec07d6f
1 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -194,6 +194,22 @@ nsTransactionManager::Undo()
LOCK_TX_MANAGER(this);
// It is illegal to call Undo() while the transaction manager is
// executing a transaction's Do() method! If this happens, the Undo()
// request is ignored, and we return NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
if (!NS_SUCCEEDED(result)) {
UNLOCK_TX_MANAGER(this);
return result;
}
if (tx) {
UNLOCK_TX_MANAGER(this);
return NS_ERROR_FAILURE;
}
// Peek at the top of the undo stack. Don't remove the transaction
// until it has successfully completed.
result = mUndoStack.Peek(&tx);
@ -229,6 +245,22 @@ nsTransactionManager::Redo()
LOCK_TX_MANAGER(this);
// It is illegal to call Redo() while the transaction manager is
// executing a transaction's Do() method! If this happens, the Redo()
// request is ignored, and we return NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
if (!NS_SUCCEEDED(result)) {
UNLOCK_TX_MANAGER(this);
return result;
}
if (tx) {
UNLOCK_TX_MANAGER(this);
return NS_ERROR_FAILURE;
}
// Peek at the top of the redo stack. Don't remove the transaction
// until it has successfully completed.
result = mRedoStack.Peek(&tx);