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

Caolán McNamara caolanm at redhat.com
Fri Dec 8 15:44:46 UTC 2017


 sw/source/filter/html/htmltab.cxx |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 8a2bbf1dd54c8efc3e2d969011e5f0bddef07013
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 8 11:25:19 2017 +0000

    valgrind: leak with abi2107-1.html
    
    Change-Id: I86d833a26cb50d65e3ec0f46175e9e6da003944b
    Reviewed-on: https://gerrit.libreoffice.org/46087
    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/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index b6e1d5db18bf..5a5b028f9ad9 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -434,7 +434,7 @@ class HTMLTable
 
     SwHTMLParser *m_pParser;          // the current parser
     HTMLTable *m_pTopTable;           // the table on the Top-Level
-    HTMLTableCnts *m_pParentContents;
+    std::unique_ptr<HTMLTableCnts> m_xParentContents;
 
     HTMLTableContext *m_pContext;    // the context of the table
 
@@ -582,8 +582,8 @@ public:
     void SetHasParentSection( bool bSet ) { m_bHasParentSection = bSet; }
     bool HasParentSection() const { return m_bHasParentSection; }
 
-    void SetParentContents( HTMLTableCnts *pCnts ) { m_pParentContents = pCnts; }
-    HTMLTableCnts *GetParentContents() const { return m_pParentContents; }
+    void SetParentContents(HTMLTableCnts *pCnts) { m_xParentContents.reset(pCnts); }
+    std::unique_ptr<HTMLTableCnts>& GetParentContents() { return m_xParentContents; }
 
     void MakeParentContents();
 
@@ -1027,7 +1027,7 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
                     pOptions->aBGImage, aEmptyOUStr, aEmptyOUStr, aEmptyOUStr );
 
     m_pContext = nullptr;
-    m_pParentContents = nullptr;
+    m_xParentContents.reset();
 
     m_aId = pOptions->aId;
     m_aClass = pOptions->aClass;
@@ -3791,15 +3791,14 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
                                 pSubTable->GetTableAdjust(false)!= SvxAdjust::Right,
                                 "left or right aligned tables belong in frames" );
 
-                        HTMLTableCnts *pParentContents =
-                            pSubTable->GetParentContents();
-                        if( pParentContents )
+                        auto& rParentContents = pSubTable->GetParentContents();
+                        if (rParentContents)
                         {
                             OSL_ENSURE( !pSaveStruct->IsInSection(),
                                     "Where is the section" );
 
                             // If there's no table coming, we have a section
-                            pSaveStruct->AddContents( pParentContents );
+                            pSaveStruct->AddContents(rParentContents.release());
                         }
 
                         const SwStartNode *pCapStNd =


More information about the Libreoffice-commits mailing list