sw/source/uibase/docvw/HeaderFooterWin.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit a64d8610fdbe56df67df03e6fadfff9ab7a0c441 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 17 10:25:54 2023 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jan 17 20:35:39 2023 +0000 Resolves: tdf#153059 after ChangeHeaderOrFooter the control can be disposed If the cursor is still on page one then when a header, via a control on another page, is added it jumps back to that page, so the widget on the now hidden page is removed, but the click handler hasn't completed so the follow up action to change it from a "plus" button to a dropdown menubutton was on a disposed widget. Change-Id: I981126412a0ee6a667d77fb97a3db2f2b0a0363c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145584 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 0e79e1481012..539a310b08aa 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -549,8 +549,13 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, weld::Button&, void) const SwPageFrame* pPageFrame = SwFrameMenuButtonBase::GetPageFrame(m_pFrame); const OUString& rStyleName = pPageFrame->GetPageDesc()->GetName(); - rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); - + { + VclPtr<SwHeaderFooterWin> xThis(this); + rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); + //tdf#153059 after ChangeHeaderOrFooter is it possible that "this" is disposed + if (xThis->isDisposed()) + return; + } m_xPushButton->hide(); m_xMenuButton->show(); PaintButton();