sw/qa/extras/uiwriter/data/tdf156560.docx |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx       |   16 ++++++++++++++++
 sw/source/core/layout/paintfrm.cxx        |    4 ++++
 3 files changed, 20 insertions(+)

New commits:
commit a99a63287f96290f5641a4216432f7b637402ea6
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Tue Aug 1 14:48:26 2023 +0200
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Thu Aug 3 11:41:27 2023 +0200

    tdf#156560 Fix assertion failure editing RTL header
    
    Clicking on an RTL header previously lead to assertion failure, but now
    it is checked if the SwFrame pointer is null. If so, an empty vector is
    returned.
    
    It should be noted that the rendering of the rtl header in the
    attachment 188689 is still wrong as the text and image are misplaced.
    
    A test is added to the patch, and can be run using:
    
     make CppunitTest_sw_uiwriter8 CPPUNIT_TEST_NAME=testTdf156560
    
    Change-Id: I9e8f66895b4ef9369300c9d7c03d22a2085a1d71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155159
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf156560.docx 
b/sw/qa/extras/uiwriter/data/tdf156560.docx
new file mode 100755
index 000000000000..8cfd5501914c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf156560.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 48b17ef211ea..621fecc6fd98 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -2674,6 +2674,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, 
testTdf62032ApplyStyle)
                          getProperty<OUString>(getParagraph(2), 
"ListLabelString").trim());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf156560)
+{
+    createSwDoc("tdf156560.docx");
+
+    uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("PageStyles")->getByName("Standard"),
+                                                   uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_PAGEUP);
+
+    // Insert header
+    // Without the fix in place, this test would have got SIGABRT here
+    dispatchCommand(mxComponent, ".uno:InsertHeader", {});
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 7c757e4d19ca..8b44b33445d5 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7070,6 +7070,10 @@ std::vector<basegfx::B2DPolygon> 
SwPageFrame::GetSubsidiaryLinesPolygons(const S
     const SwFrame* pLay = Lower();
     const SwFrame* pFootnoteCont = nullptr;
     const SwFrame* pPageBody = nullptr;
+
+    if (!pLay)
+        return aPolygons;
+
     while ( pLay && !( pFootnoteCont && pPageBody ) )
     {
         if ( pLay->IsFootnoteContFrame( ) )

Reply via email to