Kaydet (Commit) d87d2aa4 authored tarafından Michael Stahl's avatar Michael Stahl

SwRenderData: fix regression:

It turns out that the SwDoc member of SwRenderData was not actually
leaked, but was deleted via the ViewShell member.
üst 436a1a1a
...@@ -254,7 +254,7 @@ public: ...@@ -254,7 +254,7 @@ public:
// PostIt relevant data // PostIt relevant data
/// an array of "_SetGetExpFld *" sorted by page and line numbers /// an array of "_SetGetExpFld *" sorted by page and line numbers
::boost::scoped_ptr<_SetGetExpFlds> m_pPostItFields; ::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; ::boost::scoped_ptr<ViewShell> m_pPostItShell;
public: public:
...@@ -262,7 +262,7 @@ public: ...@@ -262,7 +262,7 @@ public:
~SwRenderData(); ~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 CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev );
void DeletePostItData(); void DeletePostItData();
......
...@@ -1398,11 +1398,12 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( ...@@ -1398,11 +1398,12 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
SET_CURR_SHELL( rData.m_pPostItShell.get() ); SET_CURR_SHELL( rData.m_pPostItShell.get() );
// clear document and move to end of it // 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.Move( fnMoveBackward, fnGoDoc );
aPam.SetMark(); aPam.SetMark();
aPam.Move( fnMoveForward, fnGoDoc ); aPam.Move( fnMoveForward, fnGoDoc );
rData.m_pPostItDoc->DeleteRange( aPam ); rPostItDoc.DeleteRange( aPam );
const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 );
......
...@@ -64,7 +64,6 @@ SwRenderData::SwRenderData() ...@@ -64,7 +64,6 @@ SwRenderData::SwRenderData()
SwRenderData::~SwRenderData() SwRenderData::~SwRenderData()
{ {
OSL_ENSURE( !m_pPostItShell, "m_pPostItShell should already have been deleted" ); 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" ); OSL_ENSURE( !m_pPostItFields, " should already have been deleted" );
} }
...@@ -74,7 +73,6 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, ...@@ -74,7 +73,6 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt,
DeletePostItData(); DeletePostItData();
m_pPostItFields.reset(new _SetGetExpFlds); m_pPostItFields.reset(new _SetGetExpFlds);
lcl_GetPostIts( pDoc, m_pPostItFields.get() ); lcl_GetPostIts( pDoc, m_pPostItFields.get() );
m_pPostItDoc.reset(new SwDoc);
//!! Disable spell and grammar checking in the temporary document. //!! Disable spell and grammar checking in the temporary document.
//!! Otherwise the grammar checker might process it and crash if we later on //!! 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, ...@@ -82,7 +80,7 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt,
SwViewOption aViewOpt( *pViewOpt ); SwViewOption aViewOpt( *pViewOpt );
aViewOpt.SetOnlineSpell( sal_False ); 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() ...@@ -90,10 +88,10 @@ void SwRenderData::DeletePostItData()
{ {
if (HasPostItData()) 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_pPostItShell.reset();
m_pPostItFields.reset(); m_pPostItFields.reset();
m_pPostItDoc.reset();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment