summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/undo.hxx2
-rw-r--r--svl/source/undo/undo.cxx12
-rw-r--r--sw/source/core/undo/docundo.cxx6
3 files changed, 9 insertions, 11 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
index 0847d89811c0..2757967aaee4 100644
--- a/include/svl/undo.hxx
+++ b/include/svl/undo.hxx
@@ -291,7 +291,7 @@ public:
/** removes the oldest Undo actions from the stack
*/
- void RemoveOldestUndoActions(sal_Int32 nNumToDelete);
+ void RemoveOldestUndoAction();
void dumpAsXml(xmlTextWriterPtr pWriter) const;
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 46c785557416..b678fba83948 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1123,22 +1123,18 @@ bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
}
-void SfxUndoManager::RemoveOldestUndoActions(sal_Int32 nNumToDelete)
+void SfxUndoManager::RemoveOldestUndoAction()
{
UndoManagerGuard aGuard( *m_xData );
- if ( ImplIsInListAction_Lock() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
+ if ( IsInListAction() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
{
assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!");
return;
}
- while (nNumToDelete>0 && !m_xData->pUndoArray->maUndoActions.empty())
- {
- aGuard.markForDeletion( m_xData->pUndoArray->Remove( 0 ) );
- --m_xData->pUndoArray->nCurUndoAction;
- --nNumToDelete;
- }
+ aGuard.markForDeletion( m_xData->pUndoArray->Remove( 0 ) );
+ --m_xData->pUndoArray->nCurUndoAction;
ImplCheckEmptyActions();
}
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 8f870f347d6c..6e350836fc20 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -537,8 +537,10 @@ void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTr
}
// if the undo nodes array is too large, delete some actions
- if (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
- RemoveOldestUndoActions(GetUndoNodes().Count() - UNDO_ACTION_LIMIT);
+ while (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
+ {
+ RemoveOldestUndoAction();
+ }
}
namespace {