summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-01 15:49:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-04-03 13:11:56 +0200
commit3644508aceee6019842bea1fee6c177eabd61681 (patch)
treef387675d7e493ee25d57cfdd1730dba9632c0435 /sw
parent1015359b5f4d01e2a423cbed7b155412d3f6db66 (diff)
forcepoint#98 don't delete SwFrame flagged as IsDeleteForbidden
Change-Id: I1ac2db4bf96afc4bdc8e0646576f5fa0bcd9e410 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132435 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/layout/data/forcepoint98.htmlbin0 -> 7171 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx6
-rw-r--r--sw/source/core/layout/sectfrm.cxx3
3 files changed, 8 insertions, 1 deletions
diff --git a/sw/qa/extras/layout/data/forcepoint98.html b/sw/qa/extras/layout/data/forcepoint98.html
new file mode 100644
index 000000000000..9d4b76c53e76
--- /dev/null
+++ b/sw/qa/extras/layout/data/forcepoint98.html
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 02185383cc32..33be08fd0d3c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2549,6 +2549,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
}
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint98)
+{
+ createSwWebDoc(DATA_DIRECTORY, "forcepoint98.html");
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611)
{
createSwDoc(DATA_DIRECTORY, "tdf128611.fodt");
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index ce0c7a813f51..eb667dd51fc5 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2891,7 +2891,8 @@ void SwRootFrame::DeleteEmptySct_()
mpDestroy->erase( mpDestroy->begin() );
OSL_ENSURE( !pSect->IsColLocked() && !pSect->IsJoinLocked(),
"DeleteEmptySct: Locked SectionFrame" );
- if( !pSect->getFrameArea().HasArea() && !pSect->ContainsContent() )
+ SAL_WARN_IF(pSect->IsDeleteForbidden(), "sw.layout", "not allowed delete SwFrame");
+ if( !pSect->getFrameArea().HasArea() && !pSect->ContainsContent() && !pSect->IsDeleteForbidden() )
{
SwLayoutFrame* pUp = pSect->GetUpper();
pSect->RemoveFromLayout();