diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-12-06 15:17:38 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-09 16:58:43 +0000 |
commit | d393039655edf9bb884fc2956674badde59d2326 (patch) | |
tree | 116091a5ee4d94ba6d3bd5d5049f3956290ce7d8 | |
parent | f212bd45a7c7d97fb16380cd9fa7c6abbfb71e05 (diff) |
Resolves: rhbz#1401082 gnome hangs opening a certain .docx
this seems to be a problem since....
commit 199eb08be994ef968eb38f4966bc27ef1756d382
Author: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Thu Jun 5 16:25:01 2014 +0200
SwAnchoredDrawObject::GetObjBoundRect: avoid SwDoc::SetModified()
This is a const method, but it does a const_cast to still resize an
object... if that's so, then we should ensure that the "is modified"
flag of SwDoc is untouched.
CppunitTest_sw_ooxmlimport's testChartSize is a reproducer for this,
when shape text is imported as textbox.
(note under gtk3 and wayland this isn't as noticable, there use
export GDK_BACKEND=x11 to reproduce the freeze effect where even
the mouse cursor doesn't move during part of the load)
Change-Id: Ic0bd98b032dfe1255d79d8070d50f65fcfa676dd
Reviewed-on: https://gerrit.libreoffice.org/31687
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/inc/IDocumentState.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentStateManager.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentStateManager.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/anchoreddrawobject.cxx | 7 |
4 files changed, 25 insertions, 4 deletions
diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx index 6c4ecaabaa57..eeab2efa9e1d 100644 --- a/sw/inc/IDocumentState.hxx +++ b/sw/inc/IDocumentState.hxx @@ -49,6 +49,9 @@ public: virtual void SetLoaded() = 0; + virtual bool IsEnableSetModified() const = 0; + virtual void SetEnableSetModified(bool bEnableSetModified) = 0; + protected: virtual ~IDocumentState() {}; }; diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx index 7b371d172ef5..04a865a3f70b 100644 --- a/sw/source/core/doc/DocumentStateManager.cxx +++ b/sw/source/core/doc/DocumentStateManager.cxx @@ -29,6 +29,7 @@ namespace sw DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ), + mbEnableSetModified(true), mbModified(false), mbLoaded(false), mbUpdateExpField(false), @@ -39,6 +40,9 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : void DocumentStateManager::SetModified() { + if (!IsEnableSetModified()) + return; + m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries(); mbModified = true; m_rDoc.GetDocumentStatisticsManager().SetDocStatModified( true ); @@ -75,6 +79,16 @@ bool DocumentStateManager::IsModified() const return mbModified; } +bool DocumentStateManager::IsEnableSetModified() const +{ + return mbEnableSetModified; +} + +void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified) +{ + mbEnableSetModified = bEnableSetModified; +} + bool DocumentStateManager::IsInCallModified() const { return mbInCallModified; diff --git a/sw/source/core/inc/DocumentStateManager.hxx b/sw/source/core/inc/DocumentStateManager.hxx index 99b6a86385c8..e79f94b042a4 100644 --- a/sw/source/core/inc/DocumentStateManager.hxx +++ b/sw/source/core/inc/DocumentStateManager.hxx @@ -36,6 +36,8 @@ public: void SetModified() override; void ResetModified() override; bool IsModified() const override; + bool IsEnableSetModified() const override; + void SetEnableSetModified(bool bEnableSetModified) override; bool IsInCallModified() const override; bool IsUpdateExpField() const override; bool IsNewDoc() const override; @@ -50,9 +52,10 @@ private: SwDoc& m_rDoc; + bool mbEnableSetModified; //< FALSE: changing document modification status (temporarily) locked bool mbModified ; //< TRUE: document has changed. bool mbLoaded ; //< TRUE: Doc loaded. - bool mbUpdateExpField ; //< TRUE: Update expression fields. + bool mbUpdateExpField; //< TRUE: Update expression fields. bool mbNewDoc ; //< TRUE: new Doc. bool mbInCallModified; //< TRUE: in Set/Reset-Modified link. }; diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index c4f7d9973666..c806f3febb05 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -660,12 +660,13 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) ) { SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrame()->GetFormat()->GetDoc()); - bool bModified = pDoc->getIDocumentState().IsModified(); + + bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified(); + pDoc->getIDocumentState().SetEnableSetModified(false); const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(), Fraction( nTargetWidth, aCurrObjRect.GetWidth() ), Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false ); - if (!bModified) - pDoc->getIDocumentState().ResetModified(); + pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified); } } return GetDrawObj()->GetCurrentBoundRect(); |