From 77378cde59bd9eb986f1ac8b071a5e853bc6805c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 16 Dec 2013 21:59:25 +0100 Subject: [PATCH] SvxTextEditSourceImpl::Notify(): attempt to fix chart2_unoapi crash Apparently SvxTextEditSourceImpl::mpView is not properly invalidated when the instance it points to is deleted; the SvxTextEditSourceImpl is registered as listener so try to handle this in Notify(); not sure if there isn't something that ought to have cleaned this up... Crash running with SAL_FORCE_IACCESSIBLE2=1: svxcorelo.dll!SdrPaintView::FindPaintWindow(const OutputDevice & rOut) Line 70 svxcorelo.dll!SvxTextEditSourceImpl::GetVisArea() Line 923 svxcorelo.dll!SvxTextEditSource::GetVisArea() Line 1113 svxlo.dll!accessibility::AccessibleTextHelper_Impl::UpdateVisibleChildren(bool bBroadcastEvents) Line 868 svxlo.dll!accessibility::AccessibleTextHelper_Impl::ProcessQueue() Line 1376 svxlo.dll!accessibility::AccessibleTextHelper_Impl::Notify(SfxBroadcaster & __formal, const SfxHint & rHint) Line 1530 svllo.dll!SfxBroadcaster::Broadcast(const SfxHint & rHint) Line 48 svxcorelo.dll!SvxTextEditSourceImpl::NotifyHdl(EENotify * aNotify) Line 1021 svxcorelo.dll!SvxTextEditSourceImpl::LinkStubNotifyHdl(void * pThis, void * pCaller) Line 1013 tllo.dll!Link::Call(void * pCaller) Line 123 editenglo.dll!Outliner::ImplBlockInsertionCallbacks(unsigned char b) Line 2098 editenglo.dll!Outliner::Clear() Line 2036 svxcorelo.dll!SdrOutlinerCache::disposeOutliner(SdrOutliner * pOutliner) Line 91 svxcorelo.dll!SdrModel::disposeOutliner(SdrOutliner * pOutliner) Line 1960 svxcorelo.dll!SvxTextEditSourceImpl::dispose() Line 489 svxcorelo.dll!SvxTextEditSourceImpl::Notify(SfxBroadcaster & __formal, const SfxHint & rHint) Line 458 svllo.dll!SfxBroadcaster::Broadcast(const SfxHint & rHint) Line 48 svxcorelo.dll!SdrModel::~SdrModel() Line 270 chartcorelo.dll!chart::DrawModelWrapper::~DrawModelWrapper() Line 191 chartcorelo.dll!chart::DrawModelWrapper::`vector deleting destructor'(unsigned int) chartcorelo.dll!boost::checked_delete(chart::DrawModelWrapper * x) Line 34 chartcorelo.dll!boost::detail::sp_counted_impl_p::dispose() Line 78 chartcorelo.dll!boost::detail::sp_counted_base::release() Line 104 chartcorelo.dll!boost::detail::shared_count::~shared_count() Line 381 chartcorelo.dll!boost::shared_ptr::~shared_ptr() chartcorelo.dll!boost::shared_ptr::reset() Line 626 chartcorelo.dll!chart::ChartView::~ChartView() Line 202 chartcorelo.dll!chart::ChartView::`scalar deleting destructor'(unsigned int) cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 204 chartcorelo.dll!cppu::WeakImplHelper10::release() Line 115 chartcorelo.dll!com::sun::star::uno::Reference::~Reference() Line 106 chartcorelo.dll!chart::ChartModel::~ChartModel() Line 188 chartcorelo.dll!chart::ChartModel::`vector deleting destructor'(unsigned int) cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 204 Change-Id: Ife6d6275eae74750858a7a7f57153c76a1a228a4 --- svx/source/unodraw/unoshtxt.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index da2a4810fde7..30d364fdd93e 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -333,15 +333,31 @@ void SvxTextEditSourceImpl::ChangeModel( SdrModel* pNewModel ) //------------------------------------------------------------------------ -void SvxTextEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) +void SvxTextEditSourceImpl::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { // #i105988 keep reference to this object rtl::Reference< SvxTextEditSourceImpl > xThis( this ); const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint ); + const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pViewHint ) + if (pSimpleHint) + { + if (SFX_HINT_DYING == pSimpleHint->GetId()) + { + if (&rBC == mpView) + { + mpView = 0; + if (mpViewForwarder) + { + delete mpViewForwarder; + mpViewForwarder = 0; + } + } + } + } + else if( pViewHint ) { switch( pViewHint->GetHintType() ) {