sw/inc/unotxdoc.hxx | 4 ++-- sw/source/uibase/uno/unotxdoc.cxx | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-)
New commits: commit d49e497a6bd07e487149d65ab63138ce4aff73a4 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jan 25 10:16:58 2017 +0200 use rtl::Reference in SwXTextDocument instead of storing both a raw pointer and an uno::Reference Change-Id: I94746e7fafcc7d2206ac0c1a6481e6006421529b diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 36ef233..e4aa5206 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -61,6 +61,7 @@ #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/util/XCloneable.hpp> +#include <rtl/ref.hxx> #include <svl/itemprop.hxx> #include <svx/fmdmod.hxx> #include <editeng/UnoForbiddenCharsTable.hxx> @@ -174,8 +175,7 @@ private: //temporary frame to enable PDF export if no valid view is available SfxViewFrame* m_pHiddenViewFrame; - css::uno::Reference< css::uno::XInterface> xPropertyHelper; - SwXDocumentPropertyHelper* pPropertyHelper; + rtl::Reference<SwXDocumentPropertyHelper> mxPropertyHelper; SwPrintUIOptions * m_pPrintUIOptions; SwRenderData * m_pRenderData; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2c81a20..a1ca0a0 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -422,7 +422,6 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) mxLinkTargetSupplier(), mxXRedlines(), m_pHiddenViewFrame(nullptr), - pPropertyHelper(nullptr), m_pPrintUIOptions( nullptr ), m_pRenderData( nullptr ), // #i117783# @@ -452,12 +451,11 @@ SwXTextDocument::~SwXTextDocument() SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper () { - if(!xPropertyHelper.is()) + if(!mxPropertyHelper.is()) { - pPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc()); - xPropertyHelper = static_cast<cppu::OWeakObject*>(pPropertyHelper); + mxPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc()); } - return pPropertyHelper; + return mxPropertyHelper.get(); } void SwXTextDocument::GetNumberFormatter() @@ -1600,11 +1598,10 @@ void SwXTextDocument::InitNewDoc() static_cast<SwXRedlines*>(pMarks)->Invalidate(); mxXRedlines.clear(); } - if(xPropertyHelper.is()) + if(mxPropertyHelper.is()) { - pPropertyHelper->Invalidate(); - xPropertyHelper = nullptr; - pPropertyHelper = nullptr; + mxPropertyHelper->Invalidate(); + mxPropertyHelper.clear(); } } @@ -2064,7 +2061,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) case WID_DOC_FORBIDDEN_CHARS: { GetPropertyHelper(); - Reference<XForbiddenCharacters> xRet(xPropertyHelper, UNO_QUERY); + Reference<XForbiddenCharacters> xRet(static_cast<cppu::OWeakObject*>(mxPropertyHelper.get()), UNO_QUERY); aAny <<= xRet; } break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits