From 35a79eac56f8b93b62de555ea92c28304f2333d9 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 30 May 2023 14:18:23 +0200 Subject: sw: fix infinite recursion in SwEditWin::GetSurroundingText() This is basically the same as what was fixed by commit 581ba395222e04e43697484bef9181c877d1fd61 and i'm not sure why this problem is now happening here. Change-Id: I0769d1aa0980031452b69c48dee7aaef211df25e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152390 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/uibase/docvw/edtwin.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 147ae7b1d427..648ea2334583 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6647,6 +6647,9 @@ OUString SwEditWin::GetSurroundingText() const { bool bUnLockView = !rSh.IsViewLocked(); rSh.LockView(true); + + // store shell state *before* Push + ::std::optional aLink(std::in_place, rSh); rSh.Push(); // disable accessible events for internal-only helper cursor @@ -6660,7 +6663,7 @@ OUString SwEditWin::GetSurroundingText() const rSh.GoEndSentence(); rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR ); - rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); + rSh.Pop(SwCursorShell::PopMode::DeleteCurrent, aLink); rSh.SetSendAccessibleCursorEvents(bSendAccessibleEventOld); rSh.HideCursor(); -- cgit