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

Michael Stahl mstahl at redhat.com
Mon Jun 3 07:19:11 PDT 2013


 sw/source/core/doc/docredln.cxx       |    2 +-
 sw/source/filter/ww8/writerhelper.cxx |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 460507f07177587a9bb6438a438de95c47abb3f0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jun 3 16:13:52 2013 +0200

    SwDoc::AppendRedline: fix an obscure memory leak
    
    ... that also causes ~SwIndexReg assertion on closing the document.
    
    Change-Id: Icea617c893ddc08b817a5b16f68fa128a41531d4

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 6f3e18b..a6a92a1 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -430,7 +430,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
                         {
                             // own insert-over-insert redlines:
                             // just scrap the inside ones
-                            mpRedlineTbl->Remove( n );
+                            mpRedlineTbl->DeleteAndDestroy( n );
                             bDec = true;
                         }
                         else if( POS_OVERLAP_BEHIND == eCmpPos )
commit bb6ecd8b40313b7cc83d4e619029f4e001334a52
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jun 3 12:24:18 2013 +0200

    sw: fix ~SwIndexReg assert
    
    Not really a problem, since local aRegion's point is not used after its
    node is deleted.
    
    Change-Id: Ibeb885fb31f19b02e4c3c63e3b99d00ced756810

diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 664d5aa..08c68a0 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -751,7 +751,12 @@ namespace sw
                 SwRedlineData aData(pFltRedline->eType, pFltRedline->nAutorNo,
                         pFltRedline->aStamp, aEmptyStr, 0);
 
-                mrDoc.AppendRedline(new SwRedline(aData, aRegion), true);
+                SwRedline *const pNewRedline(new SwRedline(aData, aRegion));
+                // the point node may be deleted in AppendRedline, so park
+                // the PaM somewhere safe
+                aRegion.DeleteMark();
+                *aRegion.GetPoint() = SwPosition(SwNodeIndex(mrDoc.GetNodes()));
+                mrDoc.AppendRedline(pNewRedline, true);
                 mrDoc.SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_NONE | nsRedlineMode_t::REDLINE_SHOW_INSERT |
                      nsRedlineMode_t::REDLINE_SHOW_DELETE ));
             }


More information about the Libreoffice-commits mailing list