sw/source/core/edit/edredln.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 01311bb1e4c2404354cce8934d36991d91d527b2
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Mar 31 15:18:40 2025 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Mar 31 17:32:47 2025 +0200

    cool#11357 sw redline reinstate: avoid unwanted multi- or table selection
    
    See
    
<https://gerrit.libreoffice.org/c/core/+/183270/2#message-788fb983dba403b07915e3046ab00e799b42a723>,
    if we have a table selection by the time we reinstate, this would lead
    to a use-after-free.
    
    Fix the problem by always killing table selections and multi-selections,
    we just want reinstate to work on simple selections.
    
    Change-Id: I0cef8d63125a4f5dee78b6feca24ed47ad7b0220
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183548
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index fc388d5ffd86..33ea531aa238 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -102,6 +102,9 @@ void SwEditShell::ReinstatePaM(const SwRangeRedline& 
rRedline, SwPaM& rPaM)
             return;
         }
 
+        // Get rid of table selection or multi-selection if there is one.
+        KillPams();
+
         SwShellCursor* pCursor = getShellCursor(/*bBlock=*/true);
         *pCursor->GetPoint() = *rPaM.End();
         SetMark();

Reply via email to