You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/10 12:52:08 UTC
svn commit: r1371648 - in /incubator/ooo/trunk/main/sw/source:
core/view/printdata.cxx ui/uno/unotxdoc.cxx
Author: orw
Date: Fri Aug 10 10:52:08 2012
New Revision: 1371648
URL: http://svn.apache.org/viewvc?rev=1371648&view=rev
Log:
#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>
Modified:
incubator/ooo/trunk/main/sw/source/core/view/printdata.cxx
incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx
Modified: incubator/ooo/trunk/main/sw/source/core/view/printdata.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/view/printdata.cxx?rev=1371648&r1=1371647&r2=1371648&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/view/printdata.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/view/printdata.cxx Fri Aug 10 10:52:08 2012
@@ -78,6 +78,7 @@ void SwRenderData::CreatePostItData( SwD
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;
}
}
Modified: incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx?rev=1371648&r1=1371647&r2=1371648&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx Fri Aug 10 10:52:08 2012
@@ -2783,6 +2783,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
}
else
{
+ if ( m_pRenderData->HasPostItData() )
+ {
+ m_pRenderData->DeletePostItData();
+ }
const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 );
if (nPostItMode != POSTITS_NONE)
{