sw/source/uibase/docvw/HeaderFooterWin.cxx |    5 ++---
 sw/source/uibase/wrtsh/wrtsh1.cxx          |    2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit ec1882e38139094399dc7404d68ba7ca61f7e9f3
Author:     Jim Raykowski <[email protected]>
AuthorDate: Tue Jul 2 08:54:02 2019 -0800
Commit:     Andras Timar <[email protected]>
CommitDate: Sun Aug 4 18:13:27 2019 +0200

    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 <[email protected]>
    Tested-by: Michael Stahl <[email protected]>
    (cherry picked from commit 151eae314358f9ee0df017cb89fbc8c87c969cdb)
    Reviewed-on: https://gerrit.libreoffice.org/75206
    Tested-by: Jenkins
    (cherry picked from commit 3597e95c6ec921fff04fc6387ff9427be54302bc)
    Reviewed-on: https://gerrit.libreoffice.org/76915
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 411c1f3c87d2..c2e8cf6b0688 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -441,9 +441,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 6c67f3da69ad..fc176630e498 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1802,6 +1802,8 @@ void SwWrtShell::ChangeHeaderOrFooter(
 
                 bExecute = nResult == RET_YES;
                 StartAllAction();
+                if (nResult == RET_YES)
+                    ToggleHeaderFooterEdit();
             }
             if( bExecute )
             {
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to