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

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 11 01:11:40 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |    7 ++-----
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit d26052bdb267f042256c3fac34ebf4697dbc3ceb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 11 09:10:23 2015 +0100

    DocxAttribouteOutput::m_pHyperlinkAttrList: use unique_ptr
    
    Change-Id: I7da23e7b7d35f2cf46c7dfbc8f251da2205925bb

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index f7af823..dae6e0b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1119,10 +1119,9 @@ void DocxAttributeOutput::EndRun()
     // Start the hyperlink after the fields separators or we would generate invalid file
     if ( m_pHyperlinkAttrList )
     {
-        XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList );
+        XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.release() );
 
         m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
-        m_pHyperlinkAttrList = NULL;
         m_startedHyperlink = true;
         m_nHyperLinkCount++;
     }
@@ -2221,7 +2220,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge
     else
     {
         // Output a hyperlink XML element
-        m_pHyperlinkAttrList = m_pSerializer->createAttrList();
+        m_pHyperlinkAttrList.reset(m_pSerializer->createAttrList());
 
         if ( !bBookmarkOnly )
         {
@@ -8279,7 +8278,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
     : m_rExport( rExport ),
       m_pSerializer( pSerializer ),
       m_rDrawingML( *pDrawingML ),
-      m_pHyperlinkAttrList( NULL ),
       m_bEndCharSdt(false),
       m_bStartedCharSdt(false),
       m_bStartedParaSdt(false),
@@ -8349,7 +8347,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
 
 DocxAttributeOutput::~DocxAttributeOutput()
 {
-    delete m_pHyperlinkAttrList, m_pHyperlinkAttrList = NULL;
     delete m_pColorAttrList, m_pColorAttrList = NULL;
     delete m_pBackgroundAttrList, m_pBackgroundAttrList = NULL;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 5077b64..a4fcf4d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -727,7 +727,7 @@ private:
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList;
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList;
-    ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
     /// If the current SDT around runs should be ended before the current run.
     bool m_bEndCharSdt;
     /// If an SDT around runs is currently open.


More information about the Libreoffice-commits mailing list