sw/source/uibase/docvw/AnnotationWin.cxx | 9 ++++++--- sw/source/uibase/docvw/AnnotationWin2.cxx | 10 ++++------ 2 files changed, 10 insertions(+), 9 deletions(-)
New commits: commit c497cd602d543b48888212f79ba1ecf378e415fc Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu May 30 08:47:09 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu May 30 17:47:37 2024 +0200 ubsan: runtime error: reference binding to null pointer of type 'const SwFrame' since: commit 124a988ea99096ea5080060c0d1a801528bd7a5c Date: Wed May 22 11:57:57 2024 +0100 create comment reply synchronously Change-Id: I62a6499c4dda7155e95bf8ffb344bfa81750844f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168247 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 409b8be9a7a7..db54099486af 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -120,9 +120,12 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, } #if !ENABLE_WASM_STRIP_ACCESSIBILITY - mrMgr.ConnectSidebarWinToFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame), - mrSidebarItem.GetFormatField(), - *this ); + if (rSidebarItem.maLayoutInfo.mpAnchorFrame) + { + mrMgr.ConnectSidebarWinToFrame( *(rSidebarItem.maLayoutInfo.mpAnchorFrame), + mrSidebarItem.GetFormatField(), + *this ); + } #endif if (SupportsDoubleBuffering()) diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index a20255f1c37b..378d35b174d4 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1067,16 +1067,13 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) SwDocShell* pShell = mrView.GetDocShell(); if (bReply) - pShell->GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::START, nullptr); + pShell->GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr); // synchronous dispatch mrView.GetViewFrame().GetDispatcher()->Execute(FN_POSTIT); if (bReply) { - SwUndoId nUndoId(SwUndoId::END); - mrView.GetWrtShell().GetLastUndoInfo(nullptr, &nUndoId); - // Get newly created SwPostItField and set its paraIdParent auto pPostItField = mrMgr.GetLatestPostItField(); pPostItField->SetParentId(GetTopReplyNote()->GetParaId()); @@ -1092,7 +1089,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) SwRewriter aRewriter; aRewriter.AddRule(UndoArg1, pPostItField->GetDescription()); - pShell->GetDoc()->GetIDocumentUndoRedo().EndUndo(nUndoId, &aRewriter); + pShell->GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, &aRewriter); } break; } @@ -1420,7 +1417,7 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem ) { #if !ENABLE_WASM_STRIP_ACCESSIBILITY const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame; - if ( bAnchorChanged ) + if (bAnchorChanged && mpAnchorFrame) { mrMgr.DisconnectSidebarWinFromFrame( *mpAnchorFrame, *this ); } @@ -1428,6 +1425,7 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem ) mrSidebarItem = rSidebarItem; mpAnchorFrame = mrSidebarItem.maLayoutInfo.mpAnchorFrame; + assert(mpAnchorFrame); #if !ENABLE_WASM_STRIP_ACCESSIBILITY if (mxSidebarWinAccessible)