[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Tue May 1 19:24:24 UTC 2018
sw/source/filter/xml/xmltbli.cxx | 10 ++++++++--
sw/source/filter/xml/xmltbli.hxx | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 3def66880874e5d0f06a48abfb6d3a95b6b0dae4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 1 15:17:48 2018 +0100
ofz#7002 Direct-leak
Change-Id: I7a4a00663498fe600e8dace95c60210a9f006a6f
Reviewed-on: https://gerrit.libreoffice.org/53696
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 989fe07af328..98ddb181baf1 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1251,6 +1251,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
m_pRows( new SwXMLTableRows_Impl ),
m_pTableNode( nullptr ),
m_pBox1( nullptr ),
+ m_bOwnsBox1( false ),
m_pSttNd1( nullptr ),
m_pBoxFormat( nullptr ),
m_pLineFormat( nullptr ),
@@ -1391,6 +1392,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
m_pRows( new SwXMLTableRows_Impl ),
m_pTableNode( pTable->m_pTableNode ),
m_pBox1( nullptr ),
+ m_bOwnsBox1( false ),
m_pSttNd1( nullptr ),
m_pBoxFormat( nullptr ),
m_pLineFormat( nullptr ),
@@ -1408,6 +1410,8 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
SwXMLTableContext::~SwXMLTableContext()
{
+ if (m_bOwnsBox1)
+ delete m_pBox1;
delete m_pColumnDefaultCellStyleNames;
delete m_pSharedBoxFormats;
delete m_pRows;
@@ -1808,6 +1812,7 @@ SwTableBox *SwXMLTableContext::NewTableBox( const SwStartNode *pStNd,
pBox = m_pBox1;
pBox->SetUpper( pUpper );
m_pBox1 = nullptr;
+ m_bOwnsBox1 = false;
}
else
pBox = new SwTableBox( m_pBoxFormat, *pStNd, pUpper );
@@ -2614,6 +2619,7 @@ void SwXMLTableContext::MakeTable()
m_pTableNode->GetDoc()->getIDocumentContentOperations().DeleteSection( m_pTableNode );
m_pTableNode = nullptr;
m_pBox1 = nullptr;
+ m_bOwnsBox1 = false;
m_pSttNd1 = nullptr;
return;
}
@@ -2732,10 +2738,10 @@ void SwXMLTableContext::MakeTable()
}
SwTableLine *pLine1 = m_pTableNode->GetTable().GetTabLines()[0U];
- OSL_ENSURE( m_pBox1 == pLine1->GetTabBoxes()[0U],
- "Why is box 1 change?" );
+ assert(m_pBox1 == pLine1->GetTabBoxes()[0] && !m_bOwnsBox1 && "Why is box 1 change?");
m_pBox1->m_pStartNode = m_pSttNd1;
pLine1->GetTabBoxes().erase( pLine1->GetTabBoxes().begin() );
+ m_bOwnsBox1 = true;
m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat());
m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_pBox1->GetFrameFormat());
diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx
index cc67ac13fa92..0fac390c2794 100644
--- a/sw/source/filter/xml/xmltbli.hxx
+++ b/sw/source/filter/xml/xmltbli.hxx
@@ -67,6 +67,7 @@ class SwXMLTableContext : public XMLTextTableContext
SwTableNode *m_pTableNode;
SwTableBox *m_pBox1;
+ bool m_bOwnsBox1;
const SwStartNode *m_pSttNd1;
SwTableBoxFormat *m_pBoxFormat;
More information about the Libreoffice-commits
mailing list