[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

Stephan Bergmann sbergman at redhat.com
Wed Feb 25 04:52:13 PST 2015


 sw/source/core/doc/doctxm.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 8a9b3a29ac4661c181ac56bf99767989a3b00ba8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 25 09:08:35 2015 +0100

    Fix dangling pointer
    
    Change-Id: I352702ac50708a8f8c40e2752821178223052b7c
    (cherry picked from commit 1c4e95db104cd5f732bc41a539a7dc5fd9269ef6)
    Reviewed-on: https://gerrit.libreoffice.org/14632
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index fd8f452..dcd2996 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -156,6 +156,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
     SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode());
     OSL_ENSURE( rTxtNd.GetpSwpHints(), "cannot be deleted" );
 
+    std::unique_ptr<SwRegHistory> aRHst;
     if (GetIDocumentUndoRedo().DoesUndo())
     {
         // save attributes for Undo
@@ -164,8 +165,8 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
             RES_TXTATR_TOXMARK );
         GetIDocumentUndoRedo().AppendUndo( pUndo );
 
-        SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() );
-        rTxtNd.GetpSwpHints()->Register( &aRHst );
+        aRHst.reset(new SwRegHistory(rTxtNd, &pUndo->GetHistory()));
+        rTxtNd.GetpSwpHints()->Register(aRHst.get());
     }
 
     rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) );


More information about the Libreoffice-commits mailing list