[Libreoffice-commits] core.git: sw/source

Julien Nabet serval2412 at yahoo.fr
Wed Sep 21 16:12:37 UTC 2016


 sw/source/core/docnode/node.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit cd72269a6a2c85ae9dd4552aa4808ef4fd1f6c0e
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Sep 16 22:32:29 2016 +0200

    tdf#102233: avoid infinite loop recursion in IsProtect node method
    
    See https://bugs.documentfoundation.org/show_bug.cgi?id=102233#c5
    
    Change-Id: Ic985662011b33d4b20b7c60df33c9ecc97326e85
    Reviewed-on: https://gerrit.libreoffice.org/28972
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index e42598c..19e2109 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -433,10 +433,14 @@ bool SwNode::IsProtect() const
     SwFrameFormat* pFlyFormat = GetFlyFormat();
     if( pFlyFormat )
     {
-        if( pFlyFormat->GetProtect().IsContentProtected() )
+        if (pFlyFormat->GetProtect().IsContentProtected())
             return true;
         const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor();
-        return rAnchor.GetContentAnchor() && rAnchor.GetContentAnchor()->nNode.GetNode().IsProtect();
+        const SwPosition* pAnchorPos = rAnchor.GetContentAnchor();
+        if (!pAnchorPos)
+            return false;
+        const SwNode& rAnchorNd = pAnchorPos->nNode.GetNode();
+        return &rAnchorNd != this && rAnchorNd.IsProtect();
     }
 
     if( nullptr != ( pSttNd = FindFootnoteStartNode() ) )


More information about the Libreoffice-commits mailing list