sd/inc/drawdoc.hxx          |    2 ++
 sd/source/core/drawdoc.cxx  |    2 ++
 sd/source/core/drawdoc2.cxx |    9 +++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 9f1c5f027d25bae3182aa6b7f7e349d098877636
Author:     Mohit Marathe <[email protected]>
AuthorDate: Tue Dec 16 18:56:01 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:05:27 2026 +0100

    sd: allow dtor of SdDrawDocument to remove pages unconditionally
    
    Fixes the exception:
    0 sal::backtrace_get(unsigned int) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sal/osl/unx/backtraceapi.cxx:42
    1 (anonymous namespace)::printStack(int) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sal/osl/unx/signal.cxx:289
    2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sal/osl/unx/signal.cxx:330
    3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sal/osl/unx/signal.cxx:427
    4 __restore_rt in /lib64/libpthread.so.0
    5 __GI_raise at :?
    6 __GI_abort at :?
    7 /lib64/libstdc++.so.6(+0x91f97) [0x7f4c69c91f97]
    8 std::__debug::vector<SdrPageObj*, std::allocator<SdrPageObj*> 
>::operator[](unsigned long) at 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/debug/vector:442
    9 SdDrawDocument::connectPagePreviews() at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sd/source/core/drawdoc2.cxx:1794
    10 SdDrawDocument::updatePagePreviewsGrid(SdPage*) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sd/source/core/drawdoc2.cxx:1770
    11 SdDrawDocument::RemovePage(unsigned short) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sd/source/core/drawdoc2.cxx:540
    12 SdrModel::DeletePage(unsigned short) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/svx/source/svdraw/svdmodel.cxx:1224
    13 SdDrawDocument::DeletePage(unsigned short) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sd/source/core/drawdoc2.cxx:494
    14 SdrModel::ClearModel(bool) at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/svx/source/svdraw/svdmodel.cxx:608
    15 ~SdDrawDocument at 
/home/collabora/jenkins/workspace/gerrit_linux_co-25.04_clang_dbgutil/sd/source/core/drawdoc.cxx:380
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Ie878a6a14d94a43bef9f53f2795d8cf4b768b5a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195717
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196820
    Tested-by: Jenkins

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 380c936f8c8d..a8a9267453f1 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -371,6 +371,8 @@ private:
 
     bool                mbNewOrLoadCompleted;
 
+    bool                mbDestroying = false;
+
     bool                mbOnlineSpell;
     bool                mbSummationOfParagraphs;
     sal_uInt16          mnStartWithPresentation; ///< 1-based starting slide# 
when presenting via command line parameter --show
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index eff86ff412b8..cdbc3985aff8 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -363,6 +363,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, 
SfxObjectShell* pDrDocSh)
 // Destructor
 SdDrawDocument::~SdDrawDocument()
 {
+    mbDestroying = true;
     s_pLast = nullptr;
 
     Broadcast(SdrHint(SdrHintKind::ModelCleared));
@@ -400,6 +401,7 @@ SdDrawDocument::~SdDrawDocument()
     mpOutliner.reset();
     mpInternalOutliner.reset();
     moCharClass.reset();
+    mbDestroying = false;
 }
 
 void SdDrawDocument::adaptSizeAndBorderForAllPages(
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 4ee560d3e6cd..07cc05176e93 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -507,7 +507,7 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
 {
     // Do not remove the only non-canvas page
     if (HasCanvasPage() && GetSdPageCount(PageKind::Standard) == 2
-        && nPgNum == 3)
+        && nPgNum == 3 && !mbDestroying)
         return nullptr;
     rtl::Reference<SdrPage> pPage = FmFormModel::RemovePage(nPgNum);
 
@@ -536,8 +536,10 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
 
-    if (HasCanvasPage())
+    if (HasCanvasPage() && !mbDestroying)
+    {
         updatePagePreviewsGrid(pSdPage);
+    }
 
     return pPage;
 }
commit fd03cc322676c0e4b80126fa0dbd0aab6b024acd
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Dec 15 12:15:20 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:05:17 2026 +0100

    sd: update connectors when pages are shuffled using .uno:ReshufflePages
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I1dd9d1c92298c009522d8e1c87a4d2f6918460ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195624
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196819
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 1618298e9041..4ee560d3e6cd 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1617,6 +1617,9 @@ void SdDrawDocument::ReshufflePages()
         MovePage(nCurrentPageNum + 1, nTargetPageNum + 1); // Notes page
     }
     mbSkipCanvasPreviewUpdates = false;
+
+    // update connectors
+    connectPagePreviews();
 }
 
 sal_uInt16 SdDrawDocument::GetOrInsertCanvasPage()

Reply via email to