From 197bcde5c4d771ace11962213c11c9763be11039 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 19 Feb 2021 15:54:19 +0200 Subject: loplugin:refcounting in svtools Change-Id: I20f6b07aded513a4100d7ae4c7d74365a93dacca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111221 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svtools/source/config/itemholder2.cxx | 3 ++- svtools/source/control/accessibleruler.cxx | 2 +- svtools/source/control/valueacc.cxx | 4 ++-- svtools/source/hatchwindow/hatchwindowfactory.cxx | 4 ++-- svtools/source/misc/acceleratorexecute.cxx | 11 ++++++----- svtools/source/uno/unoiface.cxx | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) (limited to 'svtools') diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 692f182a08f8..cb02d6de5e5c 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -33,6 +33,7 @@ #include #include #include +#include namespace svtools { @@ -75,7 +76,7 @@ ItemHolder2::~ItemHolder2() void ItemHolder2::holdConfigItem(EItem eItem) { - static ItemHolder2* pHolder = new ItemHolder2(); + static rtl::Reference pHolder = new ItemHolder2(); pHolder->impl_addItem(eItem); } diff --git a/svtools/source/control/accessibleruler.cxx b/svtools/source/control/accessibleruler.cxx index cfd54364e3ae..7d557a622ad4 100644 --- a/svtools/source/control/accessibleruler.cxx +++ b/svtools/source/control/accessibleruler.cxx @@ -197,7 +197,7 @@ uno::Reference< XAccessibleRelationSet > SAL_CALL SvtRulerAccessible::getAccessi uno::Reference< XAccessibleStateSet > SAL_CALL SvtRulerAccessible::getAccessibleStateSet() { ::osl::MutexGuard aGuard( m_aMutex ); - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; + rtl::Reference pStateSetHelper = new utl::AccessibleStateSetHelper; if( IsAlive() ) { diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index ff0e18959a9b..5db6e920eae3 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -218,7 +218,7 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::g uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet() { const SolarMutexGuard aSolarGuard; - ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper; + rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper; if( mpParent ) { @@ -638,7 +638,7 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::ge uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet() { ThrowIfDisposed(); - ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper(); + rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper(); // Set some states. pStateSet->AddState (accessibility::AccessibleStateType::ENABLED); diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 520cc1a25a01..36fe6c9c1104 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -56,9 +56,9 @@ uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchW throw lang::IllegalArgumentException(); // TODO SolarMutexGuard aGuard; - VCLXHatchWindow* pResult = new VCLXHatchWindow(); + rtl::Reference pResult = new VCLXHatchWindow(); pResult->initializeWindow( xParent, aBounds, aHandlerSize ); - return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) ); + return pResult; } OUString SAL_CALL OHatchWindowFactory::getImplementationName() diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 5ff9e5fa8aae..a378587fd8e5 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -36,6 +36,7 @@ #include #include #include +#include namespace svt { @@ -57,7 +58,7 @@ class AsyncAccelExec : public cppu::WeakImplHelper This instance can be forced to execute its internal set request asynchronous. After that it deletes itself! */ - static AsyncAccelExec* createOneShotInstance(const css::uno::Reference& xFrame, + static rtl::Reference createOneShotInstance(const css::uno::Reference& xFrame, const css::uno::Reference& xDispatch, const css::util::URL& rURL); @@ -215,7 +216,7 @@ bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey) } else { - AsyncAccelExec* pExec = AsyncAccelExec::createOneShotInstance(xFrame, xDispatch, aURL); + rtl::Reference pExec = AsyncAccelExec::createOneShotInstance(xFrame, xDispatch, aURL); pExec->execAsync(); } } @@ -451,20 +452,20 @@ AsyncAccelExec::AsyncAccelExec(const css::uno::Reference& , m_aURL(rURL) , m_aAsyncCallback(LINK(this, AsyncAccelExec, impl_ts_asyncCallback)) { + acquire(); } -AsyncAccelExec* AsyncAccelExec::createOneShotInstance(const css::uno::Reference &xFrame, +rtl::Reference AsyncAccelExec::createOneShotInstance(const css::uno::Reference &xFrame, const css::uno::Reference< css::frame::XDispatch >& xDispatch, const css::util::URL& rURL) { - AsyncAccelExec* pExec = new AsyncAccelExec(xFrame, xDispatch, rURL); + rtl::Reference pExec = new AsyncAccelExec(xFrame, xDispatch, rURL); return pExec; } void AsyncAccelExec::execAsync() { - acquire(); if (m_xFrame.is()) m_xFrame->addEventListener(this); m_aAsyncCallback.Post(); diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 748fcc9dd700..71bc18150c08 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -25,7 +25,7 @@ extern "C" { -SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const css::awt::WindowDescriptor* pDescriptor, vcl::Window* pParent, WinBits nWinBits ) +SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( rtl::Reference* ppNewComp, const css::awt::WindowDescriptor* pDescriptor, vcl::Window* pParent, WinBits nWinBits ) { vcl::Window* pWindow = nullptr; OUString aServiceName( pDescriptor->WindowServiceName ); -- cgit 6-appup'>distro/suse/suse-3.6-appup LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2019-03-07build: support disabling popplerAshod Nakashian
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky
2017-03-22vcl: move in PDF tokenizer from xmlsecurityMiklos Vajna
2016-10-21xmlsecurity: add PDF sign unit-testMiklos Vajna