chart2/source/view/main/DrawModelWrapper.cxx |    5 ++++-
 include/svx/svdmodel.hxx                     |    1 +
 svx/source/svdraw/svdmodel.cxx               |    7 ++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 5c52884611a0e8586ecfa8ccaf24c9e22ad5a872
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Oct 4 20:32:17 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Oct 5 12:11:38 2023 +0200

    crashtesting: crash seen on exit of chart
    
    with soffice --headless --convert-to ods forum-mso-en4-569016.xlsx
    
    and other similar
    
    Change-Id: I908fa834c1072a9854055cad1ee6261800d76aea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157573
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

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:

Reply via email to