From 19b4520fbfa8080821021586d8fe3428a2a893af Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 9 May 2018 14:00:59 +0200 Subject: loplugin:useuniqueptr in SvxOutlinerForwarder Change-Id: Ie861132b43b0a01ee8b4f3bc201bbf12f8af9f36 Reviewed-on: https://gerrit.libreoffice.org/54181 Tested-by: Jenkins Reviewed-by: Noel Grandin --- editeng/source/uno/unoforou.cxx | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'editeng') diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 3db46f1a83e9..fa8e08ed16d7 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -109,8 +109,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA else { // no, we need delete the old cache - delete mpAttribsCache; - mpAttribsCache = nullptr; + mpAttribsCache.reset(); } } @@ -122,7 +121,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA if( EditEngineAttribs::All == nOnlyHardAttrib ) { - mpAttribsCache = new SfxItemSet( aSet ); + mpAttribsCache.reset(new SfxItemSet( aSet )); maAttribCacheSelection = rSel; } @@ -146,12 +145,11 @@ SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const else { // no, we need delete the old cache - delete mpParaAttribsCache; - mpParaAttribsCache = nullptr; + mpParaAttribsCache.reset(); } } - mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) ); + mpParaAttribsCache.reset(new SfxItemSet( rOutliner.GetParaAttribs( nPara ) )); mnParaAttribsCache = nPara; EditEngine& rEditEngine = const_cast(rOutliner.GetEditEngine()); @@ -253,17 +251,8 @@ SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWh void SvxOutlinerForwarder::flushCache() { - if( mpAttribsCache ) - { - delete mpAttribsCache; - mpAttribsCache = nullptr; - } - - if( mpParaAttribsCache ) - { - delete mpParaAttribsCache; - mpParaAttribsCache = nullptr; - } + mpAttribsCache.reset(); + mpParaAttribsCache.reset(); } LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const -- cgit