sw/source/core/undo/docundo.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit 001ef1ee056a74247e9a6229f466aa268e6765c7 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jun 22 16:46:22 2023 +0200 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Jun 23 09:18:40 2023 +0200 lok: use correct shell when doing undo When doing undo we save EditShell reference in the context object. Later it is used to get cursor we want to move to the place where modification was done (in sw/source/core/undo/unins.cxx:281). In LOK case when 2 different sessions were used and undo was done by user A - then user's B cursor was moved. This fixes that issue. We use current shell instead of getting it indirectly through SwDoc::GetEditShell() Change-Id: I7a10ea98587f48818e8d0aaa9ad739d4eed514f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153461 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index a9efc248259a..57202fe3632a 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -30,6 +30,7 @@ #include <pam.hxx> #include <swundo.hxx> #include <UndoCore.hxx> +#include <wrtsh.hxx> #include <editsh.hxx> #include <unobaseclass.hxx> #include <IDocumentDrawModelAccess.hxx> @@ -666,7 +667,10 @@ bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo, size_t nUndoOffset) UnoActionContext c(& rDoc); // exception-safe StartAllAction/EndAllAction - SwEditShell *const pEditShell(rDoc.GetEditShell()); + SwView* pViewShell = dynamic_cast<SwView*>(SfxViewShell::Current()); + SwEditShell *const pEditShell( + comphelper::LibreOfficeKit::isActive() && pViewShell ? pViewShell->GetWrtShellPtr() + : rDoc.GetEditShell()); OSL_ENSURE(pEditShell, "sw::UndoManager needs a SwEditShell!"); if (!pEditShell) {