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

Michael Stahl mstahl at redhat.com
Tue May 6 13:23:41 PDT 2014


 sw/inc/editsh.hxx                                        |    2 -
 sw/inc/viewsh.hxx                                        |    2 -
 sw/source/core/layout/layact.cxx                         |   17 +++++++++------
 sw/source/core/view/viewsh.cxx                           |    4 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    4 +--
 5 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit 3ed4078ad2e1bb35829b118a5067ad3a43365bbc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 6 22:15:58 2014 +0200

    SwLayAction: there can be only one, so assert that
    
    Requires tweaking the SwLayIdle code a bit, where an action is kept
    alive a bit after it's done, which would trigger the assertion.
    
    Change-Id: Ic5c8f90bc101b9d73cfde9691b2bbf405a001393

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index f32831d..9f8de67 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -300,6 +300,7 @@ SwLayAction::SwLayAction( SwRootFrm *pRt, SwViewImp *pI ) :
     // OD 14.04.2003 #106346# - init new flag <mbFormatCntntOnInterrupt>.
     mbFormatCntntOnInterrupt = false;
 
+    assert(!pImp->pLayAct); // there can be only one SwLayAction
     pImp->pLayAct = this;   // register there
 }
 
@@ -2169,11 +2170,15 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
             pSh = (SwViewShell*)pSh->GetNext();
         } while ( pSh != pImp->GetShell() );
 
-        SwLayAction aAction( pRoot, pImp );
-        aAction.SetInputType( VCL_INPUT_ANY );
-        aAction.SetIdle( true );
-        aAction.SetWaitAllowed( false );
-        aAction.Action();
+        bool bInterrupt(false);
+        {
+            SwLayAction aAction( pRoot, pImp );
+            aAction.SetInputType( VCL_INPUT_ANY );
+            aAction.SetIdle( true );
+            aAction.SetWaitAllowed( false );
+            aAction.Action();
+            bInterrupt = aAction.IsInterrupt();
+        }
 
         // Further start/end actions only happen if there were paints started
         // somewhere or if the visibility of the CharRects has changed.
@@ -2263,7 +2268,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
             } while ( pSh != pImp->GetShell() );
         }
 
-        if ( !aAction.IsInterrupt() )
+        if (!bInterrupt)
         {
             if ( !DoIdleJob( WORD_COUNT, false ) )
                 if ( !DoIdleJob( SMART_TAGS, false ) )
commit a2e1505cf6ca0fdbe713e0cb86005a7577d125fa
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 6 22:12:21 2014 +0200

    SwViewShell: try to catch errors of calling CalcLayout without action
    
    Change-Id: I0352d543b7ce1ae6cd23d929ad5c9cbaeb1563bf

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 83c1437..305412d 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -887,6 +887,10 @@ void SwViewShell::ChgNumberDigits()
 
 void SwViewShell::CalcLayout()
 {
+    // extremely likely to be a Bad Idea to call this without StartAction
+    // (except the Page Preview apparently only has a non-subclassed ViewShell)
+    assert((typeid(*this) == typeid(SwViewShell)) || mnStartAction);
+
     SET_CURR_SHELL( this );
     SwWait aWait( *GetDoc()->GetDocShell(), true );
 
commit 83c0018dba00ae0c0cf5b179cfc7a47ce08ff2b7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 6 20:43:43 2014 +0200

    SwViewShell: fix brain-damaged non-virtual CalcLayout() override
    
    The ooxml_export test crashes on Mac, because
    SwModelTestBase::calcLayout() calls ViewShell::CalcLayout() and that
    does not do StartAction(), and inside the layout indirectly a
    StartAction()/EndAction() is then called, which of course trashes
    the still-under-construction layout.
    
    Strangely no crash on Linux, the layout is completely finished before
    the SwModelTestBase::calcLayout() is called,
    maybe because of the headless vclplug.
    
    Change-Id: I767b1e41597ce752eb8c61dc106390f2abb90257

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 79451ac..d85b55d 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -574,7 +574,7 @@ public:
     void EndAllAction();
 
     /// To enable set up of StartActions and EndActions.
-    void CalcLayout();
+    virtual void CalcLayout() SAL_OVERRIDE;
 
     /// Determine form of content. Return Type at CurCrsr->SPoint.
     sal_uInt16 GetCntType() const;
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index de76f7e..341346f 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -282,7 +282,7 @@ public:
 
      Size GetDocSize() const;   // Get document size.
 
-    void CalcLayout();  // Force complete formatting of layout.
+    virtual void CalcLayout();  // Force complete formatting of layout.
 
     sal_uInt16 GetPageCount() const;
 
commit 65d7eced14c7b2f23deafe8326af1311fa14a3cc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 6 20:42:25 2014 +0200

    DomainMapperTableManager::endOfRowAction(): valgrind warnings
    
    Change-Id: I9e59ec2d45508d8f4dee8415411182576dacc45f

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 3bf3ce3..98fa11a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -672,8 +672,8 @@ void DomainMapperTableManager::endOfRowAction()
          * then replace the TABLE_WIDTH property, set earlier.
          */
         TablePropertyMapPtr propMap = m_aTmpTableProperties.back();
-        sal_Int32 nTableWidth;
-        sal_Int32 nTableWidthType;
+        sal_Int32 nTableWidth(0);
+        sal_Int32 nTableWidthType(text::SizeType::VARIABLE);
         propMap->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth );
         propMap->getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType );
         if ((nTableWidthType == text::SizeType::FIX) && (nTableWidth < m_nTableWidth))


More information about the Libreoffice-commits mailing list