[Libreoffice-commits] core.git: sw/source
Stephan Bergmann
sbergman at redhat.com
Wed Feb 25 00:09:22 PST 2015
sw/source/core/doc/doctxm.cxx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 1c4e95db104cd5f732bc41a539a7dc5fd9269ef6
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Feb 25 09:08:35 2015 +0100
Fix dangling pointer
Change-Id: I352702ac50708a8f8c40e2752821178223052b7c
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e0fa41f..aa05171 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