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

Miklos Vajna vmiklos at collabora.co.uk
Wed Apr 22 01:00:03 PDT 2015


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

New commits:
commit 9406ab47a92386d676038e467e555c3c80b46f62
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Apr 22 09:48:36 2015 +0200

    DocxAttributeOutput::m_postponedDMLDrawing: use std::unique_ptr<>
    
    Change-Id: I0125467bad9be48ce8daa1fda32c731d8ee96b40

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a88a5b2..c9cd83d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1639,8 +1639,8 @@ void DocxAttributeOutput::StartRunProperties()
     OSL_ASSERT( !m_pPostponedVMLDrawings );
     m_pPostponedVMLDrawings.reset(new std::list<PostponedDrawing>());
 
-    assert(!m_postponedDMLDrawing);
-    m_postponedDMLDrawing = new std::list< PostponedDrawing >;
+    assert(!m_pPostponedDMLDrawings);
+    m_pPostponedDMLDrawings.reset(new std::list<PostponedDrawing>());
 
     assert( !m_pPostponedOLEs );
     m_pPostponedOLEs.reset(new std::list<PostponedOLE>());
@@ -4785,17 +4785,16 @@ void DocxAttributeOutput::WritePostponedCustomShape()
 
 void DocxAttributeOutput::WritePostponedDMLDrawing()
 {
-    if(m_postponedDMLDrawing == NULL)
+    if (!m_pPostponedDMLDrawings)
         return;
 
     // Clear the list early, this method may be called recursively.
-    std::list<PostponedDrawing>* postponedDMLDrawing = m_postponedDMLDrawing;
-    m_postponedDMLDrawing = NULL;
+    std::unique_ptr< std::list<PostponedDrawing> > pPostponedDMLDrawings(m_pPostponedDMLDrawings.release());
     std::unique_ptr< std::list<PostponedOLE> > pPostponedOLEs(m_pPostponedOLEs.release());
 
     bool bStartedParaSdt = m_bStartedParaSdt;
-    for( std::list< PostponedDrawing >::iterator it = postponedDMLDrawing->begin();
-         it != postponedDMLDrawing->end();
+    for( std::list< PostponedDrawing >::iterator it = pPostponedDMLDrawings->begin();
+         it != pPostponedDMLDrawings->end();
          ++it )
     {
         // Avoid w:drawing within another w:drawing.
@@ -4806,7 +4805,6 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
     }
     m_bStartedParaSdt = bStartedParaSdt;
 
-    delete postponedDMLDrawing;
     m_pPostponedOLEs.reset(pPostponedOLEs.release());
 }
 
@@ -4856,7 +4854,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                     }
                     else
                     {
-                        if ( m_postponedDMLDrawing == NULL )
+                        if (!m_pPostponedDMLDrawings)
                         {
                             bool bStartedParaSdt = m_bStartedParaSdt;
                             if ( IsAlternateContentChoiceOpen() )
@@ -4881,7 +4879,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                         {
                             // we are writing out attributes, but w:drawing should not be inside w:rPr, so write it out later
                             m_bPostponedProcessingFly = true ;
-                            m_postponedDMLDrawing->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft));
+                            m_pPostponedDMLDrawings->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft));
                         }
                     }
                 }
@@ -8323,7 +8321,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_startedHyperlink( false ),
       m_nHyperLinkCount(0),
       m_nFieldsInHyperlink( 0 ),
-      m_postponedDMLDrawing(NULL),
       m_postponedChart( NULL ),
       pendingPlaceholder( NULL ),
       m_postitFieldsMaxId( 0 ),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 70f5cc3..7ec1784 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -848,7 +848,7 @@ private:
         const Point* point;
     };
     std::unique_ptr< std::list<PostponedDrawing> > m_pPostponedVMLDrawings;
-    std::list< PostponedDrawing >* m_postponedDMLDrawing;
+    std::unique_ptr< std::list<PostponedDrawing> > m_pPostponedDMLDrawings;
     std::unique_ptr< std::list<PostponedDrawing> > m_pPostponedCustomShape;
 
     struct PostponedOLE


More information about the Libreoffice-commits mailing list