Author: alg Date: Fri Jun 7 11:35:51 2013 New Revision: 1490593 URL: http://svn.apache.org/r1490593 Log: i121125 Secured release of remembered data (ViewShell) in PDFExport when nothing gets exported (no call to render implementaion in Writer)
Modified: openoffice/trunk/main/sw/inc/unotxdoc.hxx openoffice/trunk/main/sw/source/ui/app/docsh.cxx openoffice/trunk/main/sw/source/ui/uno/unotxdoc.cxx Modified: openoffice/trunk/main/sw/inc/unotxdoc.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/unotxdoc.hxx?rev=1490593&r1=1490592&r2=1490593&view=diff ============================================================================== --- openoffice/trunk/main/sw/inc/unotxdoc.hxx (original) +++ openoffice/trunk/main/sw/inc/unotxdoc.hxx Fri Jun 7 11:35:51 2013 @@ -440,6 +440,8 @@ public: SwXDrawPage* GetDrawPage(); SwDocShell* GetDocShell() {return pDocShell;} + // #121125# react on ViewShell change + void ReactOnViewShellChange(); void * SAL_CALL operator new( size_t ) throw(); void SAL_CALL operator delete( void * ) throw(); Modified: openoffice/trunk/main/sw/source/ui/app/docsh.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/app/docsh.cxx?rev=1490593&r1=1490592&r2=1490593&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/ui/app/docsh.cxx (original) +++ openoffice/trunk/main/sw/source/ui/app/docsh.cxx Fri Jun 7 11:35:51 2013 @@ -1125,12 +1125,32 @@ SfxStyleSheetBasePool* SwDocShell::GetSt } +#include <unotxdoc.hxx> + void SwDocShell::SetView(SwView* pVw) { - if ( 0 != (pView = pVw) ) - pWrtShell = &pView->GetWrtShell(); - else - pWrtShell = 0; + bool bChanged(false); + + if(0 != (pView = pVw)) + { + pWrtShell = &pView->GetWrtShell(); + bChanged = true; + } + else + { + pWrtShell = 0; + bChanged = true; + } + + if(bChanged) + { + // #121125# SwXTextDocument may hold references to the ViewShell, so inform + // it about changes to allow to react on it. This happens e.g. when printing + // and/or PDF export (SwViewOptionAdjust_Impl holds a reference to the view + // and needs to be destroyed) + uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY); + ((SwXTextDocument*)xDoc.get())->ReactOnViewShellChange(); + } } Modified: openoffice/trunk/main/sw/source/ui/uno/unotxdoc.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/uno/unotxdoc.cxx?rev=1490593&r1=1490592&r2=1490593&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/ui/uno/unotxdoc.cxx (original) +++ openoffice/trunk/main/sw/source/ui/uno/unotxdoc.cxx Fri Jun 7 11:35:51 2013 @@ -3504,6 +3504,23 @@ uno::Sequence< lang::Locale > SAL_CALL S return aLanguages; } +// #121125# react on ViewShell change; a reference to the ViewShell is +// held in SwViewOptionAdjust_Impl, thus needs to be cleaned up +void SwXTextDocument::ReactOnViewShellChange() +{ + if(m_pRenderData) + { + delete m_pRenderData; + m_pRenderData = NULL; + } + + if(m_pPrintUIOptions) + { + delete m_pPrintUIOptions; + m_pPrintUIOptions = NULL; + } +} + /* -----------------25.10.99 11:06------------------- --------------------------------------------------*/