diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-04 12:01:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-04 13:27:03 +0100 |
commit | a015f2c125ebeff895984ff99267918932df529d (patch) | |
tree | 53220547fd3c5e254e5d62f628ee879078746d07 /sc/source/core/data/stlsheet.cxx | |
parent | 6449e5bb6dd1f09678e09164ef21f455132af98f (diff) |
Hack to work around an in-destruction ScStyleSheetPool no longer being one
as observed by -fsanitize=vptr e.g. during CppunitTest_sc_filters_test (though
the true fix might be to prevent all this from happening during
~ScStyleSheetPool anyway?):
ScStyleSheet::GetItemSet()
ScStyleSheet::Notify(SfxBroadcaster&, SfxHint const&)
SfxBroadcaster::Broadcast(SfxHint const&)
SfxBroadcaster::~SfxBroadcaster()
SfxStyleSheet::~SfxStyleSheet()
ScStyleSheet::~ScStyleSheet()
cppu::OWeakObject::release()
comphelper::OWeakTypeObject::release()
rtl::Reference<SfxStyleSheetBase>::~Reference()
...
std::vector<rtl::Reference<SfxStyleSheetBase>, std::allocator<rtl::Reference<SfxStyleSheetBase>>>::clear()
svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&)
SfxStyleSheetBasePool::Clear()
SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
SfxStyleSheetPool::~SfxStyleSheetPool()
ScStyleSheetPool::~ScStyleSheetPool()
cppu::OWeakObject::release()
comphelper::OWeakTypeObject::release()
rtl::Reference<ScStyleSheetPool>::clear()
ScPoolHelper::~ScPoolHelper()
salhelper::SimpleReferenceObject::release()
rtl::Reference<ScPoolHelper>::clear()
ScDocument::~ScDocument()
ScDocShell::~ScDocShell()
...
Change-Id: I1565f8dbd039de20f63ac20d6b86d7b0d2799637
Diffstat (limited to 'sc/source/core/data/stlsheet.cxx')
-rw-r--r-- | sc/source/core/data/stlsheet.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 116371a1d931..4ca80708d9ff 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -225,11 +225,18 @@ SfxItemSet& ScStyleSheet::GetItemSet() { if ( !pSet->Count() ) { - ScDocument* pDoc = static_cast<ScStyleSheetPool&>(GetPool()).GetDocument(); - if ( pDoc ) - { - sal_uLong nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge ); - pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) ); + // Hack to work around that when this code is called from + // ~ScStyleSheetPool -> ~SfxStyleSheetPool, GetPool() is no longer + // an ScStyleSheetPool: + ScStyleSheetPool * pool = dynamic_cast<ScStyleSheetPool *>( + &GetPool()); + if (pool != nullptr) { + ScDocument* pDoc = pool->GetDocument(); + if ( pDoc ) + { + sal_uLong nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge ); + pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) ); + } } } } |