summaryrefslogtreecommitdiffstats
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-07 12:14:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-09 08:47:41 +0200
commit38a684f72988f29e1c07bf9fa5a83e275e80e24c (patch)
treebf1dfcdc69d0409087856482f1730f5c1d3cb963 /svl
parentRemove unhelpful "using namespace com::sun::star;" from ucb/source/ucp/gio/ (diff)
downloadcore-38a684f72988f29e1c07bf9fa5a83e275e80e24c.tar.gz
core-38a684f72988f29e1c07bf9fa5a83e275e80e24c.zip
move constructor for SfxItemSet
Change-Id: If7f51a657606da8aea4bcf01f13468c6ac2086a8 Reviewed-on: https://gerrit.libreoffice.org/71901 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx52
1 files changed, 34 insertions, 18 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 254e8291b231..c18e0405667f 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -222,31 +222,47 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
memcpy( m_pWhichRanges, rASet.m_pWhichRanges, sizeof( sal_uInt16 ) * cnt);
}
+SfxItemSet::SfxItemSet( SfxItemSet&& rASet )
+ : m_pPool( rASet.m_pPool )
+ , m_pParent( rASet.m_pParent )
+ , m_pItems( std::move(rASet.m_pItems) )
+ , m_pWhichRanges( rASet.m_pWhichRanges )
+ , m_nCount( rASet.m_nCount )
+{
+ rASet.m_pPool = nullptr;
+ rASet.m_pParent = nullptr;
+ rASet.m_pWhichRanges = nullptr;
+ rASet.m_nCount = 0;
+}
+
SfxItemSet::~SfxItemSet()
{
- sal_uInt16 nCount = TotalCount();
- if( Count() )
+ if (m_pWhichRanges) // might be nullptr if we have been moved-from
{
- SfxPoolItem const** ppFnd = m_pItems.get();
- for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd )
- if( *ppFnd && !IsInvalidItem(*ppFnd) )
- {
- if( !(*ppFnd)->Which() )
- delete *ppFnd;
- else {
- // Still multiple references present, so just alter the RefCount
- if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) )
- (*ppFnd)->ReleaseRef();
- else
- if ( !IsDefaultItem(*ppFnd) )
- // Delete from Pool
- m_pPool->Remove( **ppFnd );
+ sal_uInt16 nCount = TotalCount();
+ if( Count() )
+ {
+ SfxPoolItem const** ppFnd = m_pItems.get();
+ for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd )
+ if( *ppFnd && !IsInvalidItem(*ppFnd) )
+ {
+ if( !(*ppFnd)->Which() )
+ delete *ppFnd;
+ else {
+ // Still multiple references present, so just alter the RefCount
+ if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) )
+ (*ppFnd)->ReleaseRef();
+ else
+ if ( !IsDefaultItem(*ppFnd) )
+ // Delete from Pool
+ m_pPool->Remove( **ppFnd );
+ }
}
- }
+ }
}
m_pItems.reset();
- if (m_pWhichRanges != m_pPool->GetFrozenIdRanges())
+ if (m_pPool && m_pWhichRanges != m_pPool->GetFrozenIdRanges())
delete[] m_pWhichRanges;
m_pWhichRanges = nullptr; // for invariant-testing
}