sw/source/uibase/docvw/edtwin.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 35a79eac56f8b93b62de555ea92c28304f2333d9
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue May 30 14:18:23 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue May 30 18:27:30 2023 +0200

    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 <michael.st...@allotropia.de>

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<SwCallLink> 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();
 

Reply via email to