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 258ef8776637519c84365b8a58446d64716b2b43
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 27 12:03:06 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Mar 27 14:49:33 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>

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 a77d11877e5b..85fd9cbcae06 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2515,6 +2515,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint91)
     createSwWebDoc(DATA_DIRECTORY, "forcepoint91.html");
 }
 
+//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 010767ccafb5..e9f552da300a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -26,6 +26,7 @@
 #include <viewimp.hxx>
 #include <fesh.hxx>
 #include <swtable.hxx>
+#include <deletelistener.hxx>
 #include <dflyobj.hxx>
 #include <anchoreddrawobject.hxx>
 #include <fmtanchr.hxx>
@@ -2135,13 +2136,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