summaryrefslogtreecommitdiff
path: root/scripting/source/provider
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-31 15:40:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-12 08:43:48 +0200
commite4e4d5713e248f02faf7aa6199b11e152973de8e (patch)
tree836dffa89d0a966e41b1af8270db74b9590def22 /scripting/source/provider
parentd4eabd5da8ea3b5ac40659c22cde19b26b3c002b (diff)
clang-tidy readability-delete-null-pointer
which in turn triggered some loplugin:useuniqueptr Change-Id: I0c38561fc9b68dac44e8cf58c8aa1f582196cc64 Reviewed-on: https://gerrit.libreoffice.org/38281 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting/source/provider')
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx15
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx11
-rw-r--r--scripting/source/provider/MasterScriptProvider.hxx3
3 files changed, 9 insertions, 20 deletions
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 773c210a7412..daaab0238454 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -44,6 +44,8 @@
#include <vector>
#include <algorithm>
+#include <memory>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::script;
@@ -165,7 +167,7 @@ class LocationBrowseNode :
public ::cppu::WeakImplHelper< browse::XBrowseNode >
{
private:
- BrowseNodeAggregatorHash* m_hBNA;
+ std::unique_ptr<BrowseNodeAggregatorHash> m_hBNA;
vString m_vStr;
OUString m_sNodeName;
Reference< browse::XBrowseNode > m_origNode;
@@ -179,18 +181,9 @@ public:
m_origNode.set( node );
}
- virtual ~LocationBrowseNode() override
- {
- if (m_hBNA)
- {
- delete m_hBNA;
- }
- }
-
// XBrowseNode
-
virtual OUString SAL_CALL getName() override
{
return m_sNodeName;
@@ -231,7 +224,7 @@ private:
void loadChildNodes()
{
- m_hBNA = new BrowseNodeAggregatorHash;
+ m_hBNA.reset( new BrowseNodeAggregatorHash );
Sequence< Reference< browse::XBrowseNode > > langNodes =
m_origNode->getChildNodes();
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 0b4baeddd981..1e26f272d2fc 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -80,11 +80,6 @@ MasterScriptProvider::MasterScriptProvider( const Reference< XComponentContext >
MasterScriptProvider::~MasterScriptProvider()
{
- if ( m_pPCache )
- {
- delete m_pPCache;
- }
- m_pPCache = nullptr;
}
@@ -362,15 +357,15 @@ MasterScriptProvider::providerCache()
if ( !m_bIsPkgMSP )
{
- m_pPCache = new ProviderCache( m_xContext, m_sAargs );
+ m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs ) );
}
else
{
- m_pPCache = new ProviderCache( m_xContext, m_sAargs, blacklist );
+ m_pPCache.reset( new ProviderCache( m_xContext, m_sAargs, blacklist ) );
}
}
}
- return m_pPCache;
+ return m_pPCache.get();
}
diff --git a/scripting/source/provider/MasterScriptProvider.hxx b/scripting/source/provider/MasterScriptProvider.hxx
index a77642587dd9..98644722393c 100644
--- a/scripting/source/provider/MasterScriptProvider.hxx
+++ b/scripting/source/provider/MasterScriptProvider.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include "ProviderCache.hxx"
+#include <memory>
namespace func_provider
{
@@ -120,7 +121,7 @@ private:
bool m_bInitialised;
bool m_bIsPkgMSP;
css::uno::Reference< css::script::provider::XScriptProvider > m_xMSPPkg;
- ProviderCache* m_pPCache;
+ std::unique_ptr<ProviderCache> m_pPCache;
osl::Mutex m_mutex;
OUString m_sCtxString;
};