From 271bddee301b0b04056719b94835bb3742cd0729 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Oct 2010 23:22:52 +0200 Subject: undoapi: yet more Undo API tests (will this ever end?) --- svl/source/undo/undo.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'svl/source/undo/undo.cxx') diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index d95a5ea5f925..67e05304c869 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -494,8 +494,10 @@ BOOL SfxUndoManager::Undo() DBG_ASSERT( m_pData->pActUndoArray == m_pData->pUndoArray, "svl::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); if ( m_pData->pActUndoArray->nCurUndoAction ) { - SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ --m_pData->pActUndoArray->nCurUndoAction ]; + SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction - 1 ]; pAction->Undo(); + // decrement nCurUndoAction *after* having called Undo - in case it raises an exception + --m_pData->pActUndoArray->nCurUndoAction; bRet = TRUE; for ( UndoListeners::const_iterator listener = m_pData->aListeners.begin(); @@ -538,8 +540,10 @@ BOOL SfxUndoManager::Redo() if ( m_pData->pActUndoArray->aUndoActions.Count() > m_pData->pActUndoArray->nCurUndoAction ) { - SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction++]; + SfxUndoAction* pAction = m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction]; pAction->Redo(); + // increment nCurUndoAction *after* having called Redo - in case it raises an exception + ++m_pData->pActUndoArray->nCurUndoAction; bRet = TRUE; for ( UndoListeners::const_iterator listener = m_pData->aListeners.begin(); -- cgit