summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2019-07-02 08:54:02 -0800
committerMichael Stahl <Michael.Stahl@cib.de>2019-07-08 16:46:12 +0200
commitfea249a4d883231bf6f6eda7146b0a86f8e591a3 (patch)
tree2441f637cec75d739ce52646a4e9f6c4b4a9d050 /sw
parentca042fea20d86aad2deac34d88010b0ab185c901 (diff)
tdf#125863 Rework tdf#107593 so header footer delete doesn't crash
Header footer delete from the last page when last page is unneeded (stack level 24 SwRootFrame::RemoveSuperfluous /// remove pages that are not needed at all) causes SwFrameMenuButtonBase::dispose() which sets m_pFrame to nullptr which causes crash when IsEmptyHeaderFooter calls GetPageFrame(). Doing ToggleHeaderFooterEdit() when header or footer deletion is accepted in SwWrtShell::ChangeHeaderOrFooter avoids the crash. SwHeaderFooterWin is also disposed which would make the GrabFocusToDocument crash if it got that far so use the shell window which is still valid here to GrabFocusToDocument. Change-Id: Iaced23e6716442671c5ea29b79be178f4fc836d3 Reviewed-on: https://gerrit.libreoffice.org/75010 Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> Tested-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit 151eae314358f9ee0df017cb89fbc8c87c969cdb) Reviewed-on: https://gerrit.libreoffice.org/75205 Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/docvw/HeaderFooterWin.cxx5
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx2
2 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index e22530d780ea..45d84a630281 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -448,9 +448,8 @@ void SwHeaderFooterWin::ExecuteCommand(const OString& rIdent)
else if (rIdent == "delete")
{
rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, false, true );
- if ( IsEmptyHeaderFooter() )
- rSh.ToggleHeaderFooterEdit();
- GrabFocusToDocument();
+ // warning: "this" may be disposed now
+ rSh.GetWin()->GrabFocusToDocument();
}
else if (rIdent == "insert_pagenumber")
{
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index cf2074b93467..16acb2c7cc5f 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1818,6 +1818,8 @@ void SwWrtShell::ChangeHeaderOrFooter(
bExecute = nResult == RET_YES;
StartAllAction();
+ if (nResult == RET_YES)
+ ToggleHeaderFooterEdit();
}
if( bExecute )
{