diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 16:28:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 23:03:17 +0200 |
commit | ddcc2ae791b3e5dcb80fa9eebc59879d927646b0 (patch) | |
tree | d5013fb7c2f382d14f35717aebd08b590793295b /sd | |
parent | bcf91144808232fa0d92184d2f1c09e5eaa1e86c (diff) |
Avoid -fsanitize=null
...during CppunitTest_sd_filters_test (see below), where
SfxStyleSheetBase::m_pPool has apparently been null'ed in
SdStyleSheet::disposing (sd/source/core/stlsheet.cxx). Presumably introduced
with dfefe448c41921f2f1e54d3f69b8b9e89031d055 "SOSAW080: Added first bunch of
basic changes to helpers"; adding a "TTTT" marker on alg_'s request.
Needed to change SfxStyleSheetBase::GetPool to return pointer instead of ref.
> include/svl/style.hxx:142:47: runtime error: reference binding to null pointer of type 'SfxStyleSheetBasePool'
> #0 in SfxStyleSheetBase::GetPool() at include/svl/style.hxx:142:40 (instdir/program/libsvxcorelo.so +0x2d7a3ed)
> #1 in sdr::properties::AttributeProperties::ImpRemoveStyleSheet() at svx/source/sdr/properties/attributeproperties.cxx:136:44 (instdir/program/libsvxcorelo.so +0x2d72f40)
> #2 in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/attributeproperties.cxx:474:25 (instdir/program/libsvxcorelo.so +0x2d793ec)
> #3 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) at svx/source/sdr/properties/textproperties.cxx:542:34 (instdir/program/libsvxcorelo.so +0x2d631f2)
> #4 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:49:24 (instdir/program/libsvllo.so +0xc2d628)
> #5 in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) at svl/source/items/style.cxx:804:16 (instdir/program/libsvllo.so +0x99e4ef)
> #6 in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) at svl/source/items/IndexedStyleSheets.cxx:202:18 (instdir/program/libsvllo.so +0x8bb852)
> #7 in SfxStyleSheetBasePool::Clear() at svl/source/items/style.cxx:815:34 (instdir/program/libsvllo.so +0x9965ea)
> #8 in SdStyleSheetPool::dispose() at sd/source/core/stlpool.cxx:1386:9 (instdir/program/libsdlo.so +0x25353a7)
> #9 in SdrModel::~SdrModel() at svx/source/svdraw/svdmodel.cxx:275:25 (instdir/program/libsvxcorelo.so +0x323f1ad)
> #10 in FmFormModel::~FmFormModel() at svx/source/form/fmmodel.cxx:94:1 (instdir/program/libsvxcorelo.so +0x465f020)
> #11 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:394:1 (instdir/program/libsdlo.so +0x2324254)
> #12 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x2324445)
> #13 in SdDrawDocument::~SdDrawDocument() at sd/source/core/drawdoc.cxx:346:1 (instdir/program/libsdlo.so +0x23244ce)
> #14 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:200:9 (instdir/program/libsdlo.so +0x2c4bdb9)
> #15 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c4a5)
> #16 in sd::DrawDocShell::~DrawDocShell() at sd/source/ui/docshell/docshell.cxx:179:1 (instdir/program/libsdlo.so +0x2c4c56e)
> #17 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:165:29 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1ff01)
> #18 in tools::SvRef<sd::DrawDocShell>::~SvRef() at include/tools/ref.hxx:56:36 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1a9fc)
> #19 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at sd/qa/unit/filters-test.cxx:78:1 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x17f53)
> #20 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5589c)
> #21 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:155:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x56519)
> #22 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 (workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x1839d)
Change-Id: Ibf61c18738c7a204ebf2bbc85b28930481b22612
Reviewed-on: https://gerrit.libreoffice.org/52554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/stlfamily.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 16 | ||||
-rw-r--r-- | sd/source/filter/xml/sdtransform.cxx | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx index 7c995c4cbe37..413699e3a533 100644 --- a/sd/source/core/stlfamily.cxx +++ b/sd/source/core/stlfamily.cxx @@ -122,7 +122,7 @@ SdStyleSheet* SdStyleFamily::GetValidNewSheet( const Any& rElement ) Reference< XStyle > xStyle( rElement, UNO_QUERY ); SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( xStyle.get() ); - if( pStyle == nullptr || (pStyle->GetFamily() != mnFamily) || (&pStyle->GetPool() != mxPool.get()) || (mxPool->Find( pStyle->GetName(), mnFamily) != nullptr) ) + if( pStyle == nullptr || (pStyle->GetFamily() != mnFamily) || (pStyle->GetPool() != mxPool.get()) || (mxPool->Find( pStyle->GetName(), mnFamily) != nullptr) ) throw IllegalArgumentException(); return pStyle; diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 7b5ef91a07fc..012546b6b7e2 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -214,7 +214,7 @@ SfxItemSet& SdStyleSheet::GetItemSet() if (!pSet) { pSet = new SfxItemSet( - GetPool().GetPool(), + GetPool()->GetPool(), svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, @@ -234,7 +234,7 @@ SfxItemSet& SdStyleSheet::GetItemSet() if (!pSet) { pSet = new SfxItemSet( - GetPool().GetPool(), + GetPool()->GetPool(), svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, @@ -265,7 +265,7 @@ SfxItemSet& SdStyleSheet::GetItemSet() if (!pSet) { pSet = new SfxItemSet( - GetPool().GetPool(), + GetPool()->GetPool(), svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, @@ -974,7 +974,7 @@ void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, con throw IllegalArgumentException(); } - SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); + SfxItemSet aSet( GetPool()->GetPool(), {{pEntry->nWID, pEntry->nWID}}); aSet.Put( rStyleSet ); if( !aSet.Count() ) @@ -987,7 +987,7 @@ void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, con } else { - aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); + aSet.Put( GetPool()->GetPool().GetDefaultItem( pEntry->nWID ) ); } } @@ -1080,7 +1080,7 @@ Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) } else { - SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); + SfxItemSet aSet( GetPool()->GetPool(), {{pEntry->nWID, pEntry->nWID}}); const SfxPoolItem* pItem; SfxItemSet& rStyleSet = GetItemSet(); @@ -1089,7 +1089,7 @@ Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) aSet.Put( *pItem ); if( !aSet.Count() ) - aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); + aSet.Put( GetPool()->GetPool().GetDefaultItem( pEntry->nWID ) ); if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny )) return aAny; @@ -1267,7 +1267,7 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) } else { - SfxItemPool& rMyPool = GetPool().GetPool(); + SfxItemPool& rMyPool = GetPool()->GetPool(); SfxItemSet aSet( rMyPool, {{pEntry->nWID, pEntry->nWID}}); aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) ); aRet = SvxItemPropertySet_getPropertyValue( pEntry, aSet ); diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx index e7d1ca8cc7a1..f496e353be0e 100644 --- a/sd/source/filter/xml/sdtransform.cxx +++ b/sd/source/filter/xml/sdtransform.cxx @@ -146,7 +146,7 @@ void SdTransformOOo2xDocument::transformStyle( SfxStyleSheetBase& rSheet ) SfxItemSet& rSet = rSheet.GetItemSet(); bool bState = false; - getBulletState( rSheet.GetItemSet(), rSheet.GetPool().Find( rSheet.GetParent(), rSheet.GetFamily() ), bState ); + getBulletState( rSheet.GetItemSet(), rSheet.GetPool()->Find( rSheet.GetParent(), rSheet.GetFamily() ), bState ); transformItemSet( rSet, bState ); removeAlienAttributes( rSet ); @@ -266,7 +266,7 @@ bool SdTransformOOo2xDocument::getBulletState( const SfxItemSet& rSet, SfxStyleS if( getBulletState( rSet, SDRATTR_XMLATTRIBUTES, rState ) ) return true; - if( pSheet && getBulletState( pSheet->GetItemSet(), pSheet->GetPool().Find( pSheet->GetParent(), pSheet->GetFamily() ), rState ) ) + if( pSheet && getBulletState( pSheet->GetItemSet(), pSheet->GetPool()->Find( pSheet->GetParent(), pSheet->GetFamily() ), rState ) ) return true; return false; |