[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/inc sw/source

Armin Le Grand alg at apache.org
Fri Jun 7 05:07:26 PDT 2013


 sw/inc/unotxdoc.hxx           |    2 ++
 sw/source/ui/app/docsh.cxx    |   22 +++++++++++++++++++++-
 sw/source/ui/uno/unotxdoc.cxx |   17 +++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit e86a463d27c1e9c12b7e9595dac0da0364fc8fe1
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Jun 7 11:35:51 2013 +0000

    i121125 Secured release of remembered data (ViewShell) in PDFExport when nothing gets exported (no call to render implementaion in Writer)

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 29051eb..f62f035 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -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();
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 1a7e34f..1e04d9d 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1125,12 +1125,32 @@ SfxStyleSheetBasePool*  SwDocShell::GetStyleSheetPool()
 }
 
 
+#include <unotxdoc.hxx>
+
 void SwDocShell::SetView(SwView* pVw)
 {
-    if ( 0 != (pView = pVw) )
+    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();
+    }
 }
 
 
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 6fa578a..bdf4833 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -3504,6 +3504,23 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
     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-------------------
 
  --------------------------------------------------*/


More information about the Libreoffice-commits mailing list