summaryrefslogtreecommitdiff
path: root/xmlscript
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 /xmlscript
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 'xmlscript')
-rw-r--r--xmlscript/source/xml_helper/xml_impctx.cxx20
1 files changed, 4 insertions, 16 deletions
diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx
index 5b3f8ae1156a..18c1666d7d4c 100644
--- a/xmlscript/source/xml_helper/xml_impctx.cxx
+++ b/xmlscript/source/xml_helper/xml_impctx.cxx
@@ -85,8 +85,8 @@ class MGuard
{
Mutex * m_pMutex;
public:
- explicit MGuard( Mutex * pMutex )
- : m_pMutex( pMutex )
+ explicit MGuard( std::unique_ptr<Mutex> const & pMutex )
+ : m_pMutex( pMutex.get() )
{ if (m_pMutex) m_pMutex->acquire(); }
~MGuard() throw ()
{ if (m_pMutex) m_pMutex->release(); }
@@ -118,7 +118,7 @@ class DocumentHandlerImpl :
std::vector< ElementEntry * > m_elements;
sal_Int32 m_nSkipElements;
- Mutex * m_pMutex;
+ std::unique_ptr<Mutex> m_pMutex;
inline Reference< xml::input::XElement > getCurrentElement() const;
@@ -136,7 +136,6 @@ public:
DocumentHandlerImpl(
Reference< xml::input::XRoot > const & xRoot,
bool bSingleThreadedUse );
- virtual ~DocumentHandlerImpl() throw () override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
@@ -187,18 +186,7 @@ DocumentHandlerImpl::DocumentHandlerImpl(
m_elements.reserve( 10 );
if (! bSingleThreadedUse)
- m_pMutex = new Mutex();
-}
-
-DocumentHandlerImpl::~DocumentHandlerImpl() throw ()
-{
- if (m_pMutex != nullptr)
- {
- delete m_pMutex;
-#if OSL_DEBUG_LEVEL == 0
- m_pMutex = nullptr;
-#endif
- }
+ m_pMutex.reset(new Mutex);
}
inline Reference< xml::input::XElement >