summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-29 14:27:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-01 06:45:31 +0100
commit207d8b88ecf43a945745194dc999348e570a5264 (patch)
treea00e0c011b850a8956dd86415e5949d1a345a651 /ucbhelper
parent478f3f019f780ae6f2464ea7ccd7a52a0ea9361c (diff)
loplugin:useuniqueptr in ContentImplHelper
Change-Id: I56909fcaf8088a353bbd0bb783c88d51b9f0822f Reviewed-on: https://gerrit.libreoffice.org/62654 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/source/provider/contenthelper.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
index 4119d91690e5..1482c036b2f1 100644
--- a/ucbhelper/source/provider/contenthelper.cxx
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -87,7 +87,7 @@ struct hashPtr
typedef std::unordered_map
<
XPropertiesChangeListenerPtr,
- PropertyEventSequence*,
+ PropertyEventSequence,
hashPtr,
equalPtr
>
@@ -696,11 +696,10 @@ void ContentImplHelper::notifyPropertiesChange(
if ( it == aListeners.end() )
{
// Not in map - create and insert new entry.
- p = new PropertyEventSequence( nCount );
- aListeners[ pListener ] = p;
+ p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
}
else
- p = (*it).second;
+ p = &it->second;
if ( p )
p->append( rEvent );
@@ -714,15 +713,13 @@ void ContentImplHelper::notifyPropertiesChange(
{
beans::XPropertiesChangeListener* pListener =
static_cast< beans::XPropertiesChangeListener * >( (*it).first );
- PropertyEventSequence* pSeq = (*it).second;
+ PropertyEventSequence pSeq = std::move(it->second);
// Remove current element.
aListeners.erase( it );
// Propagate event.
- pListener->propertiesChange( pSeq->getEvents() );
-
- delete pSeq;
+ pListener->propertiesChange( pSeq.getEvents() );
it = aListeners.begin();
}