sw/qa/extras/layout/data/forcepoint92.doc |binary
 sw/qa/extras/layout/layout.cxx            |    6 ++++++
 sw/source/core/layout/tabfrm.cxx          |    8 +++++++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 0d0cee5e48ca523f11540e9ae0ff022692fd9dca
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 27 12:03:06 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Mar 29 11:38:00 2022 +0200

    forcepoint#92 fix crash on layout of specific doc
    
    Change-Id: Id40d25d05d10d641d071cddd2e1c84594ac777a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132142
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132148
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/forcepoint92.doc 
b/sw/qa/extras/layout/data/forcepoint92.doc
new file mode 100644
index 000000000000..49c4a7f11dfe
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint92.doc differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 94edf650a359..bde69da4dde3 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2496,6 +2496,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testForcepointFootnoteFrame)
 //FIXME: disabled after failing again with fixed layout
 //CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76) { 
createSwDoc(DATA_DIRECTORY, "forcepoint76-1.rtf"); }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
+{
+    createSwDoc(DATA_DIRECTORY, "forcepoint92.doc");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
 {
     SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt");
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 7786f3aec4fc..b405a2124254 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -24,6 +24,7 @@
 #include <viewimp.hxx>
 #include <fesh.hxx>
 #include <swtable.hxx>
+#include <deletelistener.hxx>
 #include <dflyobj.hxx>
 #include <anchoreddrawobject.hxx>
 #include <fmtanchr.hxx>
@@ -2114,13 +2115,18 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
             }
             SwFootnoteBossFrame *pOldBoss = bFootnotesInDoc ? 
FindFootnoteBossFrame( true ) : nullptr;
             bool bReformat;
+            std::optional<SfxDeleteListener> oDeleteListener;
+            if (pOldBoss)
+                oDeleteListener.emplace(*pOldBoss);
             SwFrameDeleteGuard g(this);
             if ( MoveBwd( bReformat ) )
             {
+                SAL_WARN_IF(oDeleteListener && oDeleteListener->WasDeleted(), 
"sw.layout", "SwFootnoteBossFrame unexpectedly deleted");
+
                 aRectFnSet.Refresh(this);
                 bMovedBwd = true;
                 aNotify.SetLowersComplete( false );
-                if ( bFootnotesInDoc )
+                if (bFootnotesInDoc && !oDeleteListener->WasDeleted())
                     MoveLowerFootnotes( nullptr, pOldBoss, nullptr, true );
                 if ( bReformat || bKeep )
                 {

Reply via email to