[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - writerfilter/source

Caolán McNamara caolanm at redhat.com
Wed Jul 20 11:32:36 UTC 2016


 writerfilter/source/dmapper/DomainMapper.cxx      |   10 ++++++----
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++++++----
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    9 +++++++--
 3 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit c809e69dc4b76d06e86a273ebfd99c5847e59181
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 18 10:42:02 2016 +0100

    protect against empty m_aTableManagers stack
    
    Change-Id: I29fecc5e0efb3b3d907f0c6505d42818fa464ffc
    (cherry picked from commit 9d76d9d9abb08788f2882612cfe6d0df6e19af39)
    Reviewed-on: https://gerrit.libreoffice.org/27281
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 808d72592aa6e9a9f9a8eddd4dada0fa9f14749c)

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 01ec8e9..1544007 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1054,8 +1054,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 
 void DomainMapper::lcl_sprm(Sprm & rSprm)
 {
-    if( !m_pImpl->getTableManager().sprm(rSprm))
-        sprmWithProps( rSprm, m_pImpl->GetTopContext() );
+    if (!m_pImpl->hasTableManager() || !m_pImpl->getTableManager().sprm(rSprm))
+        sprmWithProps(rSprm, m_pImpl->GetTopContext());
 }
 
 sal_Int32 lcl_getCurrentNumberingProperty(
@@ -2725,7 +2725,8 @@ void DomainMapper::lcl_endSectionGroup()
 
 void DomainMapper::lcl_startParagraphGroup()
 {
-    m_pImpl->getTableManager().startParagraphGroup();
+    if (m_pImpl->hasTableManager())
+        m_pImpl->getTableManager().startParagraphGroup();
     /*
      * Add new para properties only if paragraph is not split
      * or the top context is not of paragraph properties
@@ -2762,7 +2763,8 @@ void DomainMapper::lcl_startParagraphGroup()
 void DomainMapper::lcl_endParagraphGroup()
 {
     m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
-    m_pImpl->getTableManager().endParagraphGroup();
+    if (m_pImpl->hasTableManager())
+       m_pImpl->getTableManager().endParagraphGroup();
     //frame conversion has to be executed after table conversion
     m_pImpl->ExecuteFrameConversion();
     m_pImpl->SetIsOutsideAParagraph(true);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 334264c6..ebbc3b7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -267,11 +267,13 @@ DomainMapper_Impl::~DomainMapper_Impl()
     // Don't remove last paragraph when pasting, sw expects that empty paragraph.
     if (m_bIsNewDoc)
         RemoveLastParagraph();
-    getTableManager( ).endLevel();
-    popTableManager( );
+    if (hasTableManager())
+    {
+        getTableManager().endLevel();
+        popTableManager();
+    }
 }
 
-
 uno::Reference< container::XNameContainer >    DomainMapper_Impl::GetPageStyles()
 {
     if(!m_xPageStyles.is())
@@ -1028,7 +1030,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
     TagLogger::getInstance().attribute("isTextAppend", sal_uInt32(xTextAppend.is()));
 #endif
 
-    if (xTextAppend.is() && !getTableManager( ).isIgnore() && pParaContext != nullptr)
+    if (xTextAppend.is() && pParaContext != nullptr && !getTableManager().isIgnore())
     {
         try
         {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 9372255..b60e830 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -686,6 +686,11 @@ public:
         const bool bStart,
         const sal_Int32 nAnnotationId );
 
+    bool hasTableManager() const
+    {
+        return !m_aTableManagers.empty();
+    }
+
     DomainMapperTableManager& getTableManager()
     {
         std::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top();
@@ -706,8 +711,8 @@ public:
 
     void popTableManager( )
     {
-        if ( m_aTableManagers.size( ) > 0 )
-            m_aTableManagers.pop( );
+        if (hasTableManager())
+            m_aTableManagers.pop();
     }
 
     void SetLineNumbering( sal_Int32 nLnnMod, sal_uInt32 nLnc, sal_Int32 ndxaLnn );


More information about the Libreoffice-commits mailing list