diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-10-28 22:29:15 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-10-28 22:49:28 +0200 |
commit | 87c518593de59dbf4c0f5f45c720b14a05aeca9e (patch) | |
tree | f747c3bc8c2679bcfdcd826172a48df65ee798cd /sc | |
parent | 85c38f1cf4844a99bca3d08ddfcc0c798ce5873e (diff) |
sc: remove antique reference counting hacks from ScDocumentPool
This attempt to prevent overflowing a 16-bit counter was obsoleted by
the conversion of SfxPoolItem's reference count to ULONG in 2001 or so.
Change-Id: Iafb6f151f68cbb84fda59bd134a7a4930f9a4d1f
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docpool.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 43 |
4 files changed, 0 insertions, 49 deletions
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx index 8632ed430e9b..555d411effda 100644 --- a/sc/inc/docpool.hxx +++ b/sc/inc/docpool.hxx @@ -55,8 +55,6 @@ public: virtual MapUnit GetMetric( sal_uInt16 nWhich ) const override; virtual const SfxPoolItem& Put( const SfxPoolItem&, sal_uInt16 nWhich = 0 ) override; - virtual void Remove( const SfxPoolItem& ) override; - static void CheckRef( const SfxPoolItem& ); void StyleDeleted( ScStyleSheet* pStyle ); // delete templates(?) in organizer void CellStyleCreated( const OUString& rName, ScDocument* pDoc ); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index cf5426266de2..012c94b7bef7 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -799,8 +799,6 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac { const ScPatternAttr* pOldPattern = pData[nPos].pPattern; const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &pCache->ApplyTo( *pOldPattern ) ); - ScDocumentPool::CheckRef( *pOldPattern ); - ScDocumentPool::CheckRef( *pNewPattern ); if (pNewPattern != pOldPattern) { SCROW nY1 = nStart; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index ef991cb848f4..7ec45b00ac24 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -497,8 +497,6 @@ void ScColumn::ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr ) // true = keep old content const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &aCache.ApplyTo( *pPattern ) ); - ScDocumentPool::CheckRef( *pPattern ); - ScDocumentPool::CheckRef( *pNewPattern ); if (pNewPattern != pPattern) pAttrArray->SetPattern( nRow, pNewPattern ); diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 00c60e83258e..d0677b17a9d6 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -69,9 +69,6 @@ #include "document.hxx" #include "sc.hrc" -#define SC_MAX_POOLREF (SFX_ITEMS_OLD_MAXREF - 39) -#define SC_SAFE_POOLREF (SC_MAX_POOLREF + 20) - sal_uInt16* ScDocumentPool::pVersionMap1 = nullptr; sal_uInt16* ScDocumentPool::pVersionMap2 = nullptr; sal_uInt16* ScDocumentPool::pVersionMap3 = nullptr; @@ -591,14 +588,6 @@ void ScDocumentPool::DeleteVersionMaps() pVersionMap1 = nullptr; } -/** - * The sal_uInt16 RefCount can overflow easily for the pattern attributes (SetItems): - * E.g. Alternate formatting for 600 whole cells. - * The RefCount is kept at SC_MAX_POOLREF and not increased/decreased anymore. - * This RefCount is recalculated not until the next load. - * The difference between SC_MAX_POOLREF and SC_SAFE_POOLREF is a little larger than it needs - * to be, to allow for detecting accidental "normal" changes to the RefCount (assertions). - */ const SfxPoolItem& ScDocumentPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich ) { if ( rItem.Which() != ATTR_PATTERN ) // Only Pattern is special @@ -616,41 +605,9 @@ const SfxPoolItem& ScDocumentPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWh ++mnCurrentMaxKey; const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rNew)).SetKey(mnCurrentMaxKey); } - CheckRef( rNew ); return rNew; } -void ScDocumentPool::Remove( const SfxPoolItem& rItem ) -{ - if ( rItem.Which() == ATTR_PATTERN ) // Only Pattern is special - { - sal_uInt32 nRef = rItem.GetRefCount(); - if ( nRef >= (sal_uInt32) SC_MAX_POOLREF && nRef <= (sal_uInt32) SFX_ITEMS_OLD_MAXREF ) - { - if ( nRef != (sal_uInt32) SC_SAFE_POOLREF ) - { - OSL_FAIL("Who fiddles with my ref counts?"); - SetRefCount( (SfxPoolItem&)rItem, (sal_uInt32) SC_SAFE_POOLREF ); - } - return; // Do not decrement - } - } - SfxItemPool::Remove( rItem ); -} - -void ScDocumentPool::CheckRef( const SfxPoolItem& rItem ) -{ - sal_uInt32 nRef = rItem.GetRefCount(); - if ( nRef >= (sal_uInt32) SC_MAX_POOLREF && nRef <= (sal_uInt32) SFX_ITEMS_OLD_MAXREF ) - { - // At the Apply of the Cache we might increase by 2 (to MAX+1 or SAFE+2) - // We only decrease by 1 (in LoadCompleted) - OSL_ENSURE( nRef<=(sal_uInt32)SC_MAX_POOLREF+1 || (nRef>=(sal_uInt32)SC_SAFE_POOLREF-1 && nRef<=(sal_uInt32)SC_SAFE_POOLREF+2), - "ScDocumentPool::CheckRef" ); - SetRefCount( (SfxPoolItem&)rItem, (sal_uInt32) SC_SAFE_POOLREF ); - } -} - void ScDocumentPool::StyleDeleted( ScStyleSheet* pStyle ) { sal_uInt32 nCount = GetItemCount2(ATTR_PATTERN); |