diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-10-28 15:30:12 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-10-28 17:33:43 +0200 |
commit | d87d2aa40853d6119322698b26d701a4936b52a5 (patch) | |
tree | 732a9b20bbfae632951e9e692497f87bc9ce5738 | |
parent | 436a1a1a9a79113825b1946f9aa83303a475b00e (diff) |
SwRenderData: fix regression:
It turns out that the SwDoc member of SwRenderData was not actually
leaked, but was deleted via the ViewShell member.
-rw-r--r-- | sw/inc/printdata.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/view/printdata.cxx | 8 |
3 files changed, 8 insertions, 9 deletions
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 5a3d83b6ea5d..8d29336d036b 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -254,7 +254,7 @@ public: // PostIt relevant data /// an array of "_SetGetExpFld *" sorted by page and line numbers ::boost::scoped_ptr<_SetGetExpFlds> m_pPostItFields; - ::boost::scoped_ptr<SwDoc> m_pPostItDoc; + /// this contains a SwDoc with the post-it content ::boost::scoped_ptr<ViewShell> m_pPostItShell; public: @@ -262,7 +262,7 @@ public: ~SwRenderData(); - bool HasPostItData() const { return m_pPostItShell != 0 && m_pPostItDoc != 0; } + bool HasPostItData() const { return m_pPostItShell != 0; } void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ); void DeletePostItData(); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 59751084f51c..aef0e49db0ff 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1398,11 +1398,12 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( SET_CURR_SHELL( rData.m_pPostItShell.get() ); // clear document and move to end of it - SwPaM aPam( rData.m_pPostItDoc->GetNodes().GetEndOfContent() ); + SwDoc & rPostItDoc(*rData.m_pPostItShell->GetDoc()); + SwPaM aPam(rPostItDoc.GetNodes().GetEndOfContent()); aPam.Move( fnMoveBackward, fnGoDoc ); aPam.SetMark(); aPam.Move( fnMoveForward, fnGoDoc ); - rData.m_pPostItDoc->DeleteRange( aPam ); + rPostItDoc.DeleteRange( aPam ); const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 5b64ed450467..3e9bd46c39e1 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -64,7 +64,6 @@ SwRenderData::SwRenderData() SwRenderData::~SwRenderData() { OSL_ENSURE( !m_pPostItShell, "m_pPostItShell should already have been deleted" ); - OSL_ENSURE( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" ); OSL_ENSURE( !m_pPostItFields, " should already have been deleted" ); } @@ -74,7 +73,6 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, DeletePostItData(); m_pPostItFields.reset(new _SetGetExpFlds); lcl_GetPostIts( pDoc, m_pPostItFields.get() ); - m_pPostItDoc.reset(new SwDoc); //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -82,7 +80,7 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, SwViewOption aViewOpt( *pViewOpt ); aViewOpt.SetOnlineSpell( sal_False ); - m_pPostItShell.reset(new ViewShell(*m_pPostItDoc, 0, &aViewOpt, pOutDev)); + m_pPostItShell.reset(new ViewShell(*new SwDoc, 0, &aViewOpt, pOutDev)); } @@ -90,10 +88,10 @@ void SwRenderData::DeletePostItData() { if (HasPostItData()) { - m_pPostItDoc->setPrinter( 0, false, false ); // So that the printer remains at the real DOC + // So that the printer remains at the real DOC + m_pPostItShell->GetDoc()->setPrinter( 0, false, false ); m_pPostItShell.reset(); m_pPostItFields.reset(); - m_pPostItDoc.reset(); } } |