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

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 13 01:13:10 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |   11 +++--------
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit 26b500afcaed704db7a300836f466517c309ee77
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 13 09:12:11 2015 +0100

    DocxAttributeOutput::m_pBackgroundAttrList: use unique_ptr
    
    Change-Id: Ide0a7b42fb3f5d679574f9236056ad319972e61f

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ac557f5..99b4fbc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -860,8 +860,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties()
 
     if ( m_pBackgroundAttrList )
     {
-        XFastAttributeListRef xAttrList( m_pBackgroundAttrList );
-        m_pBackgroundAttrList = NULL;
+        XFastAttributeListRef xAttrList( m_pBackgroundAttrList.release() );
 
         m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList );
     }
@@ -7533,15 +7532,14 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
 
         if( !m_pBackgroundAttrList )
         {
-            m_pBackgroundAttrList = m_pSerializer->createAttrList();
+            m_pBackgroundAttrList.reset(m_pSerializer->createAttrList());
             m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() );
             m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" );
         }
         else if ( sOriginalFill != sColor )
         {
             // fill was modified during edition, theme fill attribute must be dropped
-            delete m_pBackgroundAttrList;
-            m_pBackgroundAttrList = m_pSerializer->createAttrList();
+            m_pBackgroundAttrList.reset(m_pSerializer->createAttrList());
             m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() );
             m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" );
         }
@@ -8280,7 +8278,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_bEndCharSdt(false),
       m_bStartedCharSdt(false),
       m_bStartedParaSdt(false),
-      m_pBackgroundAttrList( NULL ),
       m_endPageRef( false ),
       m_pFootnotesList( new ::docx::FootnotesList() ),
       m_pEndnotesList( new ::docx::FootnotesList() ),
@@ -8345,8 +8342,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
 
 DocxAttributeOutput::~DocxAttributeOutput()
 {
-    delete m_pBackgroundAttrList, m_pBackgroundAttrList = NULL;
-
     delete m_pFootnotesList, m_pFootnotesList = NULL;
     delete m_pEndnotesList, m_pEndnotesList = NULL;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 2311b86..234f357 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -737,7 +737,7 @@ private:
     /// Attributes of the run color
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pColorAttrList;
     /// Attributes of the paragraph background
-    ::sax_fastparser::FastAttributeList *m_pBackgroundAttrList;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
     OUString m_sOriginalBackgroundColor;
     OUString m_hyperLinkAnchor;
     bool m_endPageRef;


More information about the Libreoffice-commits mailing list