Fix for blocker bug 126770 (Undo/Redo doesn't work in Text widgets, Composer, and Mail)

mozilla/editor/txmgr/src/nsTransactionManager.cpp
  mozilla/editor/txmgr/src/nsTransactionStack.cpp

    - nsTransactionStack::Peek() was intended to return NULL for
      an empty stack so I changed timeless' change for bug 114166
      to return NS_OK and init the return value to zero.

    - timeless also changed the behavior of nsDeque::End(), it no
      longer returns an interator that is one past the end. So
      nsTransactionStack::Peek() had to call CurrentItem() instead
      of operator--.

    - I also backed out the changes made to nsTransactionManager.cpp
      cause they are unnecessary with the changes made to
      nsTransactionStack::Peek() above.

r=timeless@bemail.org  sr=hyatt@netscape.com  a=leaf@mozilla.org
This commit is contained in:
kin%netscape.com 2002-02-20 23:22:31 +00:00
Родитель fc97637ad6
Коммит 9c3b461964
2 изменённых файлов: 18 добавлений и 24 удалений

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

@ -482,26 +482,22 @@ nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
LOCK_TX_MANAGER(this);
result = mDoStack.GetSize(&total);
if (NS_SUCCEEDED(result) && total) {
// It is illegal to call SetMaxTransactionCount() while the transaction
// manager is executing a transaction's DoTransaction() method because
// the undo and redo stacks might get pruned! If this happens, the
// SetMaxTransactionCount() request is ignored, and we return
// NS_ERROR_FAILURE.
// It is illegal to call SetMaxTransactionCount() while the transaction
// manager is executing a transaction's DoTransaction() method because
// the undo and redo stacks might get pruned! If this happens, the
// SetMaxTransactionCount() request is ignored, and we return
// NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
result = mDoStack.Peek(&tx);
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
return result;
}
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
return result;
}
if (tx) {
UNLOCK_TX_MANAGER(this);
return NS_ERROR_FAILURE;
}
if (tx) {
UNLOCK_TX_MANAGER(this);
return NS_ERROR_FAILURE;
}
// If aMaxCount is less than zero, the user wants unlimited

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

@ -101,14 +101,12 @@ nsTransactionStack::Peek(nsTransactionItem **aTransaction)
if (!aTransaction)
return NS_ERROR_NULL_POINTER;
if (!mQue.GetSize())
return NS_ERROR_NULL_POINTER;
if (!mQue.GetSize()) {
*aTransaction = 0;
return NS_OK;
}
/* nsDeque's End() method returns an iterator that is
* passed the last entry of the deque. We need to decrement
* to get to the last entry.
*/
*aTransaction = (nsTransactionItem *)(--mQue.End());
*aTransaction = (nsTransactionItem *)(mQue.End().GetCurrent());
return NS_OK;
}