summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-25 09:08:35 +0100
committerAndras Timar <andras.timar@collabora.com>2015-03-04 03:12:54 -0800
commit89e01e22b4dc617fb45922620217f59e2d29e3e0 (patch)
tree08999612b04b5cf971d98ed0cde83972e9a47961
parent290df79d3f65b7b1d3d81d0cd81b6e3f31dfd581 (diff)
Fix dangling pointer
(cherry picked from commit 1c4e95db104cd5f732bc41a539a7dc5fd9269ef6) Conflicts: sw/source/core/doc/doctxm.cxx Change-Id: I352702ac50708a8f8c40e2752821178223052b7c Reviewed-on: https://gerrit.libreoffice.org/14633 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 76f57ccc93558a2b6c6c734c0b5e3a51755136fd)
-rw-r--r--sw/source/core/doc/doctxm.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index c16f576eb479..5536387d483d 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -19,6 +19,7 @@
#include <limits.h>
#include <hintids.hxx>
+#include <boost/scoped_ptr.hpp>
#include <comphelper/string.hxx>
#include <editeng/langitem.hxx>
#include <editeng/formatbreakitem.hxx>
@@ -162,6 +163,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode());
OSL_ENSURE( rTxtNd.GetpSwpHints(), "cannot be deleted" );
+ boost::scoped_ptr<SwRegHistory> aRHst;
if (GetIDocumentUndoRedo().DoesUndo())
{
// save attributes for Undo
@@ -170,8 +172,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) );