Blob Blame History Raw
From 5fc783dace4a3ecd3a63b1c5b087346fe3b449b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 15 Jan 2015 14:43:27 +0000
Subject: [PATCH] Resolves: rhbz#1162352 SwDataChanged dtor accesses deleted
 PaM

an old bug that I finally hit on by typing one paragraph
of three lines consisting of repeated "Apple " and the cursor
at position 0 and click the bullet icon

(cherry picked from commit 3cb3396e4a4b36e5a05892da16b076feaef6b2b1)

Conflicts:
	sw/source/core/doc/docfmt.cxx

Change-Id: I90e998561f2645ebfa51423bcaab9a4195144338
---
 sw/source/core/doc/docfmt.cxx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 43cfe77..34ceca7 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -66,6 +66,7 @@
 #include <SwUndoFmt.hxx>
 #include <UndoManager.hxx>
 #include <docsh.hxx>
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star::i18n;
 using namespace ::com::sun::star::lang;
@@ -376,10 +377,10 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
     }
 
     // #i96644#
-    std::auto_ptr< SwDataChanged > pDataChanged;
+    boost::scoped_ptr< SwDataChanged > xDataChanged;
     if ( bSendDataChangedEvents )
     {
-        pDataChanged.reset( new SwDataChanged( *pPam ) );
+        xDataChanged.reset( new SwDataChanged( *pPam ) );
     }
     SwHistory* pHst = 0;
     if (GetIDocumentUndoRedo().DoesUndo())
@@ -481,10 +482,12 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
         GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstTxtAttr, &aPara );
     }
 
+    SetModified();
+
+    xDataChanged.reset(); //before delete pPam
+
     if( pPam != &rRg )
         delete pPam;
-
-    SetModified();
 }
 
 #define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
-- 
1.9.3