sd/source/core/sdpage.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 9dee54299cb5c6877f68b061c47bb907df90ddcc
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Mar 5 19:29:57 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Mar 6 14:38:08 2022 +0100

    clear UserCall in SdPage destructor
    
    because I want to ref-count SdrObject, which changes the lifecycles
    of these objects, and then if an SdPage dies before an SdrObject
    we have a dangling m_pUserCall pointer.
    
    Change-Id: Ia08178c1b2f288f6d9d489fb9fd79e67bc3ea61c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131065
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 5221fd718c54..38318f29455e 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -176,6 +176,15 @@ SdPage::~SdPage()
 
     clearChildNodes(mxAnimationNode);
 
+    // disconnect the UserCall link
+    SdrObjListIter aIter( this, SdrIterMode::DeepWithGroups );
+    while( aIter.IsMore() )
+    {
+        SdrObject* pChild = aIter.Next();
+        if( pChild->GetUserCall() == this )
+            pChild->SetUserCall(nullptr);
+    }
+
     // clear SdrObjects with broadcasting
     ClearSdrObjList();
 }

Reply via email to