diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-05-24 15:40:35 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-05-25 16:48:25 +0200 |
commit | eca5c1a294ac4a8ba28d5b1df47799c462393e0f (patch) | |
tree | fd68f8764eb1bd085d8e2e46e8cfcefeb10dcd73 | |
parent | 96b3bee1d13236cfe5132e3decf5dd1e8986251a (diff) |
sw: fix wrong downcast in UndoManager::IsViewUndoActionIndependent()
In case a user types in one view, an other user types in an other view,
finally the first user deletes, then getting the undo state resulted in
a memory corruption.
This went wrong in commit 2875c65946e59f5dd7968155463bf00bd71d440b (sw,
out of order undo: allow a subset of a non-empty redo list, 2021-11-11),
the intention was to check if we have a redo item and it has the
expected type, but we checked the type of an earlier undo action that
belongs to the view.
Fix the problem by checking the type of the correct undo action, this
was probably a copy&paste error of mine.
Resolves <https://github.com/CollaboraOnline/online/issues/6412>.
(cherry picked from commit f0a9d4d4eea6562e98fd92a2797d16504e1d4db5)
Change-Id: I6cb2a081067695a045d86b4ef427cc5a76c0f9c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152272
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 3370e7298ed1..12598e094eb6 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -414,7 +414,7 @@ bool UndoManager::IsViewUndoActionIndependent(const SwView* pView, sal_uInt16& r for (size_t i = 0; i < GetRedoActionCount(); ++i) { auto pRedoAction = dynamic_cast<const SwUndo*>(GetRedoAction(i)); - if (!pRedoAction || pViewSwAction->GetId() != SwUndoId::TYPING) + if (!pRedoAction || pRedoAction->GetId() != SwUndoId::TYPING) { return false; } |