sw/source/core/frmedt/feshview.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 1e89f956622b2763da1d0c6e3b90c1b54dadc3f9
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Thu Oct 31 11:04:42 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Nov 5 21:25:06 2024 +0100

    tdf#163699 sw: fix reported crash using the Navigator
    
    "On a specific file, when double-clicking multiple times on
    different images in the navigator panel, LO crashes."
    reported by Vladislav Tarakanov with a code pointer.
    
    Regression since 3e0650fb166cac116a43f6ce5d03bd69830e37b8
    "tdf#157533 sw: fix cursor position deselecting formula in table".
    
    Change-Id: I550d61d8ee10205ff2357c2511ae0062077d651e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175855
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit 5115079520192ad48ce7ce14027f5a75fc83a4cf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175914
    Reviewed-by: László Németh <nem...@numbertext.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index e05d4fb10fe4..0a3830009e99 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -217,8 +217,9 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
                                 pOldSelFly->GetAnchorFrame()->GetUpper() )
                         {
                             const SwNode * pOldNd = 
pContact->GetAnchorNode().FindTableNode();
+                            const SwNode * pNewNd = 
GetCursor()->GetPointNode().FindTableNode();
                             // the original image was in a table, but the 
cursor is not in that
-                            if ( pOldNd && pOldNd != 
GetCursor()->GetPointNode().FindTableNode() )
+                            if ( pOldNd && pOldNd != pNewNd )
                             {
                                 const SwRect& rCellFrame =
                                     
pOldSelFly->GetAnchorFrame()->GetUpper()->getFrameArea();
@@ -229,8 +230,10 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
                                     pWrtShell->SelectTableRowCol( 
aPtCellTopRight );
                             }
                             // same table, but not in the same cell
-                            else if ( pContact->GetAnchorNode().GetTableBox() 
!=
-                                            
GetCursor()->GetPointNode().GetTextNode()->GetTableBox() )
+                            else if ( pOldNd && pOldNd == pNewNd &&
+                                    GetCursor()->GetPointNode().GetTextNode() 
&&
+                                    pContact->GetAnchorNode().GetTableBox() !=
+                                    
GetCursor()->GetPointNode().GetTextNode()->GetTableBox() )
                             {
                                 aPt.setX( aPt.getX() + 2 + 
pOldSelFly->getFrameArea().Width() );
                                 // put the text cursor after the object

Reply via email to