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.mcnamara@collabora.com>
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 409b8be..db54099 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 a20255f..378d35b 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)