diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2012-08-10 09:52:08 +0000 |
---|---|---|
committer | Oliver-Rainer Wittmann <orw@apache.org> | 2012-08-10 09:52:08 +0000 |
commit | 6a72b1cd5808cf771b9358ffdc8600513d599bb1 (patch) | |
tree | 54c83008251d52cc81c4cf819072655289f2ed45 /sw | |
parent | 57e971e46ac74422c40cd3e7b4b7eb7c94711da0 (diff) |
#120389# - Printing in Writer
-- <SwRenderData> instance takes complete ownership of created comments printing data
-- fix memory leak regarding multiple creations of comments printing data
Found by: arthurgoldberg <artg at cs dot nyu dot edu>
Notes
Notes:
prefer: d53e12c7a9c2d0a3b487303673c1fafd09f6593c
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/view/printdata.cxx | 11 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 63d2514fdf61..638e88da1972 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -78,6 +78,7 @@ void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, m_pPostItFields = new _SetGetExpFlds; lcl_GetPostIts( pDoc, m_pPostItFields ); m_pPostItDoc = new SwDoc; + m_pPostItDoc->acquire(); //!! Disable spell and grammar checking in the temporary document. //!! Otherwise the grammar checker might process it and crash if we later on @@ -94,11 +95,15 @@ void SwRenderData::DeletePostItData() if (HasPostItData()) { m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt - delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab. - delete m_pPostItFields; - m_pPostItDoc = 0; + delete m_pPostItShell; m_pPostItShell = 0; + delete m_pPostItFields; m_pPostItFields = 0; + if ( !m_pPostItDoc->release() ) + { + delete m_pPostItDoc; + } + m_pPostItDoc = 0; } } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 679dde184b17..cac2b779ffeb 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2783,6 +2783,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } else { + if ( m_pRenderData->HasPostItData() ) + { + m_pRenderData->DeletePostItData(); + } const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); if (nPostItMode != POSTITS_NONE) { |