include/svl/undo.hxx            |    2 +-
 svl/source/undo/undo.cxx        |   12 ++++--------
 sw/source/core/undo/docundo.cxx |    6 ++++--
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 0b3ff97d7d5a1e8471e494f4141165364203c192
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Oct 1 16:46:11 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 1 20:54:53 2020 +0200

    tdf#136728: Revert "tdf#136238 speed up deleting large cross page table"
    
    This reverts commit da5c289a9cae5d914937f235694fd5b0cb92547f.
    
    Change-Id: Ic6a77ec2cd3b502fb4e94159a0424340850590df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103665
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to