sd/source/ui/unoidl/unomodel.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
New commits: commit 7422b7b60631f0f43fad7781d9f4b0e7fb5a4fb8 Author: Miklos Vajna <[email protected]> AuthorDate: Mon Oct 6 09:15:15 2025 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Oct 20 15:50:53 2025 +0200 sd: fix crash in SdDrawPagesAccess::remove() Crashreport signature: > kit-1853625-1853625 2025-10-05 16:19:13.871457 +0000 [ kitbroker_02b ] SIG Fatal signal received: SIGSEGV code: 1 for address: 0x100 ... > program/libmergedlo.so > SdrUndoPage::SdrUndoPage(SdrPage&) > svx/source/svdraw/svdundo.cxx:1308 > program/libmergedlo.so > SdrUndoDelPage::SdrUndoDelPage(SdrPage&) > svx/source/svdraw/svdundo.cxx:1383 > program/libmergedlo.so > std::_Head_base<0ul, SdrUndoAction*, false>::_Head_base<SdrUndoAction*&>(SdrUndoAction*&) > /opt/rh/devtoolset-12/root/usr/include/c++/12/tuple:200 > program/libsdlo.so > SdDrawPagesAccess::remove(com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> const&) > sd/source/ui/unoidl/unomodel.cxx:5181 (discriminator 4) and gdb on the coredump says: > #5 0x000070373442496a in SdDrawPagesAccess::remove (this=0x6caee6e0, xPage=...) > at /home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/sd/source/ui/unoidl/unomodel.cxx:5181 > 5181 rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); > (gdb) print pNotesPage > $5 = <optimized out> > (gdb) down > #4 SdrUndoFactory::CreateUndoDeletePage (this=<optimized out>, rPage=...) at /home/collabora/jenkins/workspace/build_core_co-25.04_for_online_snapshot/svx/source/svdraw/svdundo.cxx:1763 > 1763 return std::make_unique<SdrUndoDelPage>(rPage); > (gdb) print &rPage > $6 = (SdrPage *) 0x0 so check for the case when pNotesPage is nullptr. Change-Id: I1033d5196b329cb648fd27ac2633833a723f47a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191948 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 81c26f3c3f9c3b3672b6bbc34605d121ffaa1b72) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192718 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1f898823497c..7a65a95b4cee 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -5179,12 +5179,18 @@ void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPag // Add undo actions and delete the pages. The order of adding // the undo actions is important. rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) ); - rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); + if (pNotesPage) + { + rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); + } rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); } rDoc.RemovePage( nPage ); // the page - rDoc.RemovePage( nPage ); // the notes page + if (pNotesPage) + { + rDoc.RemovePage( nPage ); // the notes page + } if( bUndo ) {
