[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - writerfilter/source

Caolán McNamara caolanm at redhat.com
Mon Jul 18 14:27:04 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 808d72592aa6e9a9f9a8eddd4dada0fa9f14749c
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>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 80206df..4a08120 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1040,8 +1040,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(
@@ -2795,7 +2795,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
@@ -2832,7 +2833,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 a219894..6b8176f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -266,11 +266,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())
@@ -1034,7 +1036,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 be6bb26..710e067 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -698,6 +698,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();
@@ -718,8 +723,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