[Libreoffice-commits] core.git: sfx2/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Jan 23 10:30:16 UTC 2018
sfx2/source/explorer/nochaos.cxx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
New commits:
commit 746c89bf919d579fde0ff96eb379fa5d46601fae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jan 16 15:58:39 2018 +0200
loplugin:useuniqueptr in CntStaticPoolDefaults_Impl
Change-Id: I8d7766d473499b4d154debc1aafaf03359078aa3
Reviewed-on: https://gerrit.libreoffice.org/48372
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sfx2/source/explorer/nochaos.cxx b/sfx2/source/explorer/nochaos.cxx
index 2ba551d4662a..edb1a560765d 100644
--- a/sfx2/source/explorer/nochaos.cxx
+++ b/sfx2/source/explorer/nochaos.cxx
@@ -37,7 +37,7 @@ class CntItemPool;
class CntStaticPoolDefaults_Impl
{
static const sal_uInt32 m_nItems = 1;
- std::vector<SfxPoolItem*>* m_pDefaults;
+ std::vector<SfxPoolItem*> mvDefaults;
std::unique_ptr<SfxItemInfo[]> m_pItemInfos;
private:
@@ -49,7 +49,7 @@ public:
CntStaticPoolDefaults_Impl(const CntStaticPoolDefaults_Impl&) = delete;
CntStaticPoolDefaults_Impl& operator=(const CntStaticPoolDefaults_Impl&) = delete;
- std::vector<SfxPoolItem*>* GetDefaults() const { return m_pDefaults; }
+ std::vector<SfxPoolItem*>* GetDefaults() { return &mvDefaults; }
const SfxItemInfo* GetItemInfos() const { return m_pItemInfos.get(); }
};
@@ -161,7 +161,7 @@ inline void CntStaticPoolDefaults_Impl::Insert(
{
sal_uInt16 nPos = pItem->Which() - WID_CHAOS_START;
- (*m_pDefaults)[ nPos ] = pItem;
+ mvDefaults[ nPos ] = pItem;
m_pItemInfos[ nPos ]._nSID = 0;
m_pItemInfos[ nPos ]._bPoolable = true;
}
@@ -170,14 +170,12 @@ inline void CntStaticPoolDefaults_Impl::Insert(
CntStaticPoolDefaults_Impl::~CntStaticPoolDefaults_Impl()
{
for ( sal_uInt32 n = 0; n < m_nItems; ++n )
- delete (*m_pDefaults)[ n ];
-
- delete m_pDefaults;
+ delete mvDefaults[ n ];
}
CntStaticPoolDefaults_Impl::CntStaticPoolDefaults_Impl()
-: m_pDefaults( new std::vector<SfxPoolItem*>( m_nItems, nullptr ) ),
+: mvDefaults( m_nItems, nullptr ),
m_pItemInfos( new SfxItemInfo [ m_nItems ] )
{
memset( m_pItemInfos.get(), 0, sizeof( SfxItemInfo ) * m_nItems );
More information about the Libreoffice-commits
mailing list