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

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