[Libreoffice-commits] core.git: svl/source
Stephan Bergmann
sbergman at redhat.com
Tue Jan 12 23:28:08 PST 2016
svl/source/items/itempool.cxx | 53 +++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 26 deletions(-)
New commits:
commit dc85ef3aeb28edc51a61115d15ebe6dba8bd1ef8
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 13 08:26:27 2016 +0100
tdf#97077: So ppStaticDefaults can be null after all
...at least in Base, and the assumption in
43de9a5b0f68a77a10595b3f69c6145cd9be05b6 "What these SAL_INFO probably want to
tell us..." was wrong
Change-Id: Ic9377b72f35c130ecd34dbf76c1f6a0f4b235c69
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index f58dbad..1ecf9b8 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -402,12 +402,12 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool )
if ( pImp->mpSecondary )
{
#ifdef DBG_UTIL
- // Delete() did not yet run?
- if ( !pImp->maPoolItems.empty() && !pImp->mpSecondary->pImp->maPoolItems.empty() )
+ if (pImp->ppStaticDefaults != nullptr && !pImp->maPoolItems.empty()
+ && !pImp->mpSecondary->pImp->maPoolItems.empty())
+ // Delete() did not yet run?
{
// Does the Master have SetItems?
bool bHasSetItems = false;
- assert(pImp->ppStaticDefaults);
for ( sal_uInt16 i = 0; !bHasSetItems && i < pImp->mnEnd - pImp->mnStart; ++i )
bHasSetItems = dynamic_cast<const SfxSetItem *>(pImp->ppStaticDefaults[i]) != nullptr;
@@ -517,35 +517,36 @@ void SfxItemPool::Delete()
sal_uInt16 nArrCnt;
// Collect the SetItems first
- assert(pImp->ppStaticDefaults);
- for ( nArrCnt = GetSize_Impl();
- nArrCnt;
- --nArrCnt, ++itrItemArr, ++ppDefaultItem, ++ppStaticDefaultItem )
- {
- // *ppStaticDefaultItem could've already been deleted in a class derived
- // from SfxItemPool
- // This causes chaos in Itempool!
- if ( *ppStaticDefaultItem && dynamic_cast< const SfxSetItem* >(*ppStaticDefaultItem) != nullptr )
+ if (pImp->ppStaticDefaults != nullptr) {
+ for ( nArrCnt = GetSize_Impl();
+ nArrCnt;
+ --nArrCnt, ++itrItemArr, ++ppDefaultItem, ++ppStaticDefaultItem )
{
- if ( *itrItemArr )
+ // *ppStaticDefaultItem could've already been deleted in a class derived
+ // from SfxItemPool
+ // This causes chaos in Itempool!
+ if ( *ppStaticDefaultItem && dynamic_cast< const SfxSetItem* >(*ppStaticDefaultItem) != nullptr )
{
- SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*itrItemArr)->begin();
- for ( size_t n = (*itrItemArr)->size(); n; --n, ++ppHtArr )
- if (*ppHtArr)
- {
+ if ( *itrItemArr )
+ {
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*itrItemArr)->begin();
+ for ( size_t n = (*itrItemArr)->size(); n; --n, ++ppHtArr )
+ if (*ppHtArr)
+ {
#ifdef DBG_UTIL
- ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() );
+ ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() );
#endif
- delete *ppHtArr;
- }
- DELETEZ( *itrItemArr );
- }
- if ( *ppDefaultItem )
- {
+ delete *ppHtArr;
+ }
+ DELETEZ( *itrItemArr );
+ }
+ if ( *ppDefaultItem )
+ {
#ifdef DBG_UTIL
- SetRefCount( **ppDefaultItem, 0 );
+ SetRefCount( **ppDefaultItem, 0 );
#endif
- DELETEZ( *ppDefaultItem );
+ DELETEZ( *ppDefaultItem );
+ }
}
}
}
More information about the Libreoffice-commits
mailing list