summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-09-10 14:27:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-10 16:02:49 +0200
commitda5c289a9cae5d914937f235694fd5b0cb92547f (patch)
tree16c6eeeaad8b7c8d2589317637fcc4e4ed1d43dc /svl
parent6d790ba76991be3a01f40636fa3b9e220a8d73d8 (diff)
tdf#136238 speed up deleting large cross page table
Goes from more than 30s to less than 1s on my pc. We were getting stuck inside the loop in sw::UndoManager::AddUndoAction, because the RemoveOldestUndoAction was continually doing nothing because it was hitting the if ( IsInListAction() { assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!"); return; } code. Which means that there is some bug here, but I'm not sure what. We are deep inside the delete logic at that point, and it doesn't seem unreasonable to opportunistically delete some of the UNDO list at that point. So the real fix is just the conversion from a while loop to an if-check. Change-Id: Ie2707009dd6574b996421f67d952ab9fdaaaf6aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102378 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/undo/undo.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index b678fba83948..46c785557416 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1123,18 +1123,22 @@ bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
}
-void SfxUndoManager::RemoveOldestUndoAction()
+void SfxUndoManager::RemoveOldestUndoActions(sal_Int32 nNumToDelete)
{
UndoManagerGuard aGuard( *m_xData );
- if ( IsInListAction() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
+ if ( ImplIsInListAction_Lock() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
{
assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!");
return;
}
- aGuard.markForDeletion( m_xData->pUndoArray->Remove( 0 ) );
- --m_xData->pUndoArray->nCurUndoAction;
+ while (nNumToDelete>0 && !m_xData->pUndoArray->maUndoActions.empty())
+ {
+ aGuard.markForDeletion( m_xData->pUndoArray->Remove( 0 ) );
+ --m_xData->pUndoArray->nCurUndoAction;
+ --nNumToDelete;
+ }
ImplCheckEmptyActions();
}