sw/inc/ndgrf.hxx                 |    3 ++-
 sw/source/core/graphic/ndgrf.cxx |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit bda5fcbbbe13d4fb78ae33722e254395850556ac
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Fri Mar 6 16:12:59 2020 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sun Mar 29 23:49:24 2020 +0200

    tdf#131185 Prevent unnecessary SwapIn calls.
    
    When the http response is 404 or something like
    that we shouldn't retry the download embeded image
    constantly. This causes libreoffice to short freezes.
    
    Change-Id: I7381d04f12e9fbea961dd0e3333ea0d39aa93d14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90102
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com>
    (cherry picked from commit 30b23d77c894bdf6f7ae0d18d594ea267a80f662)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90271
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit ddd7277b218204dca539b3f93d36098df0349b38)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91296
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 2faed3ec01e8..3621292cfa46 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -39,7 +39,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode
     std::unique_ptr<GraphicObject> mpReplacementGraphic;
     tools::SvRef<sfx2::SvBaseLink> refLink;       ///< If graphics only as 
link then pointer is set.
     Size nGrfSize;
-    bool bInSwapIn              :1;
+    bool bInSwapIn               :1; // to avoid recursion in SwGrfNode::SwapIn
+    bool bInBaseLinkSwapIn      :1; // to avoid recursion in SwBaseLink::SwapIn
 
     bool bChgTwipSize           :1;
     bool bFrameInPaint          :1; ///< To avoid Start-/EndActions in Paint 
via SwapIn.
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index e8c237f10fb0..6a87796169cd 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -68,6 +68,7 @@ SwGrfNode::SwGrfNode(
         SwAttrSet const * pAutoAttr ) :
     SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
     maGrfObj(),
+    bInBaseLinkSwapIn(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -84,6 +85,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
                       SwAttrSet const * pAutoAttr ) :
     SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
     maGrfObj(rGrfObj),
+    bInBaseLinkSwapIn(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -105,6 +107,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
                       SwAttrSet const * pAutoAttr ) :
     SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
     maGrfObj(),
+    bInBaseLinkSwapIn(true),
     // #i73788#
     mbLinkedInputStreamReady( false ),
     mbIsStreamReadOnly( false )
@@ -448,13 +451,15 @@ bool SwGrfNode::SwapIn(bool bWaitForData)
 
     if( pLink )
     {
-        if( GraphicType::NONE == maGrfObj.GetType() ||
-            GraphicType::Default == maGrfObj.GetType() )
+        if( (GraphicType::NONE == maGrfObj.GetType() ||
+             GraphicType::Default == maGrfObj.GetType()) &&
+            bInBaseLinkSwapIn)
         {
             // link was not loaded yet
             if( pLink->SwapIn( bWaitForData ) )
             {
                 bRet = true;
+                bInBaseLinkSwapIn = false;
             }
             else if( GraphicType::Default == maGrfObj.GetType() )
             {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to