diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-25 15:25:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-26 08:59:39 +0200 |
commit | fd84276cf31182c80fc07c88537f9524c4d80e8c (patch) | |
tree | dcc78ba44b6123d6a00ab7e69f349319b8d2dbb4 /vbahelper/source | |
parent | 08730055c9baed59e8efd825fc593bb39b0ab49c (diff) |
loplugin:useuniqueptr in VbaApplicationBase_Impl
Change-Id: I4ce3cba4a6f5cfec677550a4263bb3e4cc795c49
Reviewed-on: https://gerrit.libreoffice.org/60974
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper/source')
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index c10ce37aef61..a441653551e4 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -145,7 +145,7 @@ struct VbaTimerInfoHash } }; -typedef std::unordered_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash > VbaTimerHashMap; +typedef std::unordered_map< VbaTimerInfo, std::unique_ptr<VbaTimer>, VbaTimerInfoHash > VbaTimerHashMap; struct VbaApplicationBase_Impl final { @@ -154,18 +154,6 @@ struct VbaApplicationBase_Impl final OUString msCaption; VbaApplicationBase_Impl() : mbVisible( true ) {} - - ~VbaApplicationBase_Impl() - { - // remove the remaining timers - for ( VbaTimerHashMap::iterator aIter = m_aTimerHash.begin(); - aIter != m_aTimerHash.end(); - ++aIter ) - { - delete aIter->second; - aIter->second = nullptr; - } - } }; VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext ) @@ -395,15 +383,13 @@ void SAL_CALL VbaApplicationBase::OnTime( const uno::Any& aEarliestTime, const O VbaTimerHashMap::iterator aIter = m_pImpl->m_aTimerHash.find( aTimerIndex ); if ( aIter != m_pImpl->m_aTimerHash.end() ) { - delete aIter->second; - aIter->second = nullptr; m_pImpl->m_aTimerHash.erase( aIter ); } if ( bSetTimer ) { VbaTimer* pTimer = new VbaTimer; - m_pImpl->m_aTimerHash[ aTimerIndex ] = pTimer; + m_pImpl->m_aTimerHash[ aTimerIndex ].reset(pTimer); pTimer->Start( this, aFunction, nEarliestTime, nLatestTime ); } } |