Blame SOURCES/0001-Resolves-rhbz-1401082-gnome-hangs-opening-a-certain-.patch

f325b2
From 9f5e3b61e7b3a7dd3cca369d153b3993b10496ed Mon Sep 17 00:00:00 2001
f325b2
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f325b2
Date: Tue, 6 Dec 2016 15:17:38 +0000
f325b2
Subject: [PATCH] Resolves: rhbz#1401082 gnome hangs opening a certain .docx
f325b2
MIME-Version: 1.0
f325b2
Content-Type: text/plain; charset=UTF-8
f325b2
Content-Transfer-Encoding: 8bit
f325b2
f325b2
this seems to be a problem since....
f325b2
f325b2
commit 199eb08be994ef968eb38f4966bc27ef1756d382
f325b2
Author: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date:   Thu Jun 5 16:25:01 2014 +0200
f325b2
f325b2
    SwAnchoredDrawObject::GetObjBoundRect: avoid SwDoc::SetModified()
f325b2
f325b2
    This is a const method, but it does a const_cast to still resize an
f325b2
    object... if that's so, then we should ensure that the "is modified"
f325b2
    flag of SwDoc is untouched.
f325b2
f325b2
    CppunitTest_sw_ooxmlimport's testChartSize is a reproducer for this,
f325b2
    when shape text is imported as textbox.
f325b2
f325b2
(note under gtk3 and wayland this isn't as noticable, there use
f325b2
export GDK_BACKEND=x11 to reproduce the freeze effect where even
f325b2
the mouse cursor doesn't move during part of the load)
f325b2
f325b2
Change-Id: Ic0bd98b032dfe1255d79d8070d50f65fcfa676dd
f325b2
Reviewed-on: https://gerrit.libreoffice.org/31687
f325b2
Tested-by: Jenkins <ci@libreoffice.org>
f325b2
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
(cherry picked from commit d393039655edf9bb884fc2956674badde59d2326)
f325b2
Reviewed-on: https://gerrit.libreoffice.org/31948
f325b2
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
f325b2
Tested-by: Caolán McNamara <caolanm@redhat.com>
f325b2
---
f325b2
 sw/inc/IDocumentState.hxx                    |  3 +++
f325b2
 sw/source/core/doc/DocumentStateManager.cxx  | 13 +++++++++++++
f325b2
 sw/source/core/inc/DocumentStateManager.hxx  |  5 ++++-
f325b2
 sw/source/core/layout/anchoreddrawobject.cxx |  7 ++++---
f325b2
 4 files changed, 24 insertions(+), 4 deletions(-)
f325b2
f325b2
diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx
f325b2
index a6fc748..41fa8e4 100644
f325b2
--- a/sw/inc/IDocumentState.hxx
f325b2
+++ b/sw/inc/IDocumentState.hxx
f325b2
@@ -58,6 +58,9 @@ public:
f325b2
 
f325b2
     virtual void SetLoaded(bool b = true) = 0;
f325b2
 
f325b2
+    virtual bool IsEnableSetModified() const = 0;
f325b2
+    virtual void SetEnableSetModified(bool bEnableSetModified) = 0;
f325b2
+
f325b2
 protected:
f325b2
     virtual ~IDocumentState() {};
f325b2
 };
f325b2
diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx
f325b2
index ede8ef9..cf755e1 100644
f325b2
--- a/sw/source/core/doc/DocumentStateManager.cxx
f325b2
+++ b/sw/source/core/doc/DocumentStateManager.cxx
f325b2
@@ -29,6 +29,7 @@ namespace sw
f325b2
 
f325b2
 DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
f325b2
     m_rDoc( i_rSwdoc ),
f325b2
+    mbEnableSetModified(true),
f325b2
     mbModified(false),
f325b2
     mbLoaded(false),
f325b2
     mbUpdateExpField(false),
f325b2
@@ -40,6 +41,8 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
f325b2
 
f325b2
 void DocumentStateManager::SetModified()
f325b2
 {
f325b2
+    if (!IsEnableSetModified())
f325b2
+        return;
f325b2
     m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries();
f325b2
     // give the old and new modified state to the link
f325b2
     //  Bit 0:  -> old state
f325b2
@@ -80,6 +83,16 @@ bool DocumentStateManager::IsModified() const
f325b2
     return mbModified;
f325b2
 }
f325b2
 
f325b2
+bool DocumentStateManager::IsEnableSetModified() const
f325b2
+{
f325b2
+    return mbEnableSetModified;
f325b2
+}
f325b2
+
f325b2
+void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified)
f325b2
+{
f325b2
+    mbEnableSetModified = bEnableSetModified;
f325b2
+}
f325b2
+
f325b2
 bool DocumentStateManager::IsInCallModified() const
f325b2
 {
f325b2
     return mbInCallModified;
f325b2
diff --git a/sw/source/core/inc/DocumentStateManager.hxx b/sw/source/core/inc/DocumentStateManager.hxx
f325b2
index 1d67a36..f3ca7d9 100644
f325b2
--- a/sw/source/core/inc/DocumentStateManager.hxx
f325b2
+++ b/sw/source/core/inc/DocumentStateManager.hxx
f325b2
@@ -38,6 +38,8 @@ public:
f325b2
     void SetModified() SAL_OVERRIDE;
f325b2
     void ResetModified() SAL_OVERRIDE;
f325b2
     bool IsModified() const SAL_OVERRIDE;
f325b2
+    bool IsEnableSetModified() const SAL_OVERRIDE;
f325b2
+    void SetEnableSetModified(bool bEnableSetModified) SAL_OVERRIDE;
f325b2
     bool IsInCallModified() const SAL_OVERRIDE;
f325b2
     bool IsLoaded() const SAL_OVERRIDE;
f325b2
     bool IsUpdateExpField() const SAL_OVERRIDE;
f325b2
@@ -51,9 +53,10 @@ public:
f325b2
 private:
f325b2
     SwDoc& m_rDoc;
f325b2
 
f325b2
+    bool mbEnableSetModified; //< FALSE: changing document modification status (temporarily) locked
f325b2
     bool mbModified      ;    //< TRUE: document has changed.
f325b2
     bool mbLoaded        ;    //< TRUE: Doc loaded.
f325b2
-    bool mbUpdateExpField  ;    //< TRUE: Update expression fields.
f325b2
+    bool mbUpdateExpField;    //< TRUE: Update expression fields.
f325b2
     bool mbNewDoc        ;    //< TRUE: new Doc.
f325b2
     bool mbPageNums      ;    //< TRUE: There are virtual page numbers.
f325b2
     bool mbInCallModified;    //< TRUE: in Set/Reset-Modified link.
f325b2
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
f325b2
index 7051a2a..644d7e6 100644
f325b2
--- a/sw/source/core/layout/anchoreddrawobject.cxx
f325b2
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
f325b2
@@ -659,12 +659,13 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
f325b2
         if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) )
f325b2
         {
f325b2
             SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrm()->GetFormat()->GetDoc());
f325b2
-            bool bModified = pDoc->getIDocumentState().IsModified();
f325b2
+
f325b2
+            bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified();
f325b2
+            pDoc->getIDocumentState().SetEnableSetModified(false);
f325b2
             const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(),
f325b2
                     Fraction( nTargetWidth, aCurrObjRect.GetWidth() ),
f325b2
                     Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false );
f325b2
-            if (!bModified)
f325b2
-                pDoc->getIDocumentState().ResetModified();
f325b2
+            pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
f325b2
         }
f325b2
     }
f325b2
     return GetDrawObj()->GetCurrentBoundRect();
f325b2
-- 
f325b2
2.9.3
f325b2