diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 1767d2ccdb6b..d5aff15c6660 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -101,8 +101,11 @@ DrawModelWrapper::DrawModelWrapper() DrawModelWrapper::~DrawModelWrapper() { + // normally call from ~SdrModel, but do it here explicitly before we clear m_xChartItemPool + implDtorClearModel(); + //remove m_pChartItemPool from pool chain - if(m_xChartItemPool) + if (m_xChartItemPool) { SfxItemPool* pPool = &GetItemPool(); for (;;) diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index a5a3a10a2763..9016c9a03fe0 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -252,6 +252,7 @@ public: tools::Long nLower = 0); protected: + void implDtorClearModel(); virtual css::uno::Reference< css::uno::XInterface > createUnoModel(); private: diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index a368af5a1a5e..ef4ffdfb9c29 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -200,7 +200,7 @@ SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHel mpImpl->initTheme(); } -SdrModel::~SdrModel() +void SdrModel::implDtorClearModel() { mbInDestruction = true; @@ -216,6 +216,11 @@ SdrModel::~SdrModel() m_pCurrentUndoGroup.reset(); ClearModel(true); +} + +SdrModel::~SdrModel() +{ + implDtorClearModel(); #ifdef DBG_UTIL // SdrObjectLifetimeWatchDog: