[Libreoffice-commits] .: sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Wed Jun 1 07:07:17 PDT 2011


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

New commits:
commit d5fa8a8a1c9f4cf3f2ed337e1a876cf644661603
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jun 1 15:24:34 2011 +0200

    keep a copy of WW8_SepInfo object, not just a pointer
    
    The pointer points inside an array, which may get resized (and
    thus reallocated), making the pointer dangling.

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index bf090f1..85ee6df 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -288,7 +288,7 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
     m_pSerializer->mark();
 
     // no section break in this paragraph yet; can be set in SectionBreak()
-    m_pSectionInfo = NULL;
+    m_pSectionInfo.reset();
 
     m_bParagraphOpened = true;
 }
@@ -393,7 +393,7 @@ void DocxAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode )
     if ( m_pSectionInfo )
     {
         m_rExport.SectionProperties( *m_pSectionInfo );
-        m_pSectionInfo = NULL;
+        m_pSectionInfo.reset();
     }
 
     InitCollectedParagraphProperties();
@@ -2426,7 +2426,7 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectio
                 {
                     // postpone the output of this; it has to be done inside the
                     // paragraph properties, so remember it until then
-                    m_pSectionInfo = pSectionInfo;
+                    m_pSectionInfo.reset( new WW8_SepInfo( *pSectionInfo ));
                 }
             }
             else
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index bf7c7d3..ef8360b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -41,6 +41,7 @@
 #include <fldbas.hxx>
 
 #include <vector>
+#include <boost/scoped_ptr.hpp>
 
 class SwGrfNode;
 class SdrObject;
@@ -541,7 +542,7 @@ private:
     ::docx::FootnotesList *m_pEndnotesList;
     int m_footnoteEndnoteRefTag;
 
-    const WW8_SepInfo *m_pSectionInfo;
+    boost::scoped_ptr< const WW8_SepInfo > m_pSectionInfo;
 
     /// Redline data to remember in the text run.
     const SwRedlineData *m_pRedlineData;


More information about the Libreoffice-commits mailing list