sd/source/core/drawdoc2.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit e7474615ce4f885d9d94708f3ef4f74a3828af11
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Dec 15 15:08:43 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:05:46 2026 +0100

    sd: add page count check in SdDrawDocument::connectPagePreviews
    
    return early if the document has only one non-canvas page
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I79cb8277f5ed62a1f683c1c6a4b18844267dddf6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195651
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196822
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 6fda0a76e7f3..88612cc7e640 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1776,7 +1776,8 @@ void SdDrawDocument::connectPagePreviews()
     if (!HasCanvasPage())
         return;
     SdrObjList* pObjList = mpCanvasPage.get();
-    std::vector<SdrPageObj*> aPageOrder(GetSdPageCount(PageKind::Standard) - 
1, nullptr);
+    sal_uInt16 nPageCount = GetSdPageCount(PageKind::Standard);
+    std::vector<SdrPageObj*> aPageOrder(nPageCount - 1, nullptr);
 
     SdrObjListIter aIter(pObjList, SdrIterMode::Flat);
     for (SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next())
@@ -1795,6 +1796,10 @@ void SdDrawDocument::connectPagePreviews()
         }
     }
 
+    // return if the document has only one non-canvas page
+    if (nPageCount == 2)
+        return;
+
     for (size_t i = 0; i < aPageOrder.size() - 1; i++)
     {
         SdrPageObj* pPageObj1 = aPageOrder[i];
commit 1b427e1b0871dfaf995e7a845df624ec2dc3c0c5
Author:     Mohit Marathe <[email protected]>
AuthorDate: Tue Dec 16 19:23:14 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 09:05:36 2026 +0100

    sd: do not call updatePagePreviewsGrid for notes page
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Ia50627ee3df36f4b1843109a0a62426ed7f3cdd4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195718
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196821
    Tested-by: Jenkins

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 07cc05176e93..6fda0a76e7f3 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -536,7 +536,7 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
         SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
     }
 
-    if (HasCanvasPage() && !mbDestroying)
+    if (HasCanvasPage() && pSdPage->GetPageKind() == PageKind::Standard && 
!mbDestroying)
     {
         updatePagePreviewsGrid(pSdPage);
     }

Reply via email to