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

New commits:
commit af50adb7d6bc3826a5a43f543630127f577f059a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Mar 31 15:18:40 2025 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Mar 31 16:13:30 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/+/183546
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index f8d8bee10709..39f5049b5fd4 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -100,6 +100,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