Kaydet (Commit) 802477ae authored tarafından Miklos Vajna's avatar Miklos Vajna

i#95698 sw: fix crash on splitting in-table section containing a nested table

Found by crashtesting, ooo95698-1.odt crashed sw layout on load. The
intended use-case is splitting section frames inside a table frame, so
can just blacklist the non-interesting table-in-section-in-table case
that causes the problem here.

Change-Id: Ic47cd8c46cc71f7eaa36b03ec2c4a5df8ca8051c
Reviewed-on: https://gerrit.libreoffice.org/41224Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 8b07ce58
...@@ -264,6 +264,7 @@ public: ...@@ -264,6 +264,7 @@ public:
#if HAVE_MORE_FONTS #if HAVE_MORE_FONTS
void testTableInSection(); void testTableInSection();
void testTableInNestedSection(); void testTableInNestedSection();
void testTableInSectionInTable();
void testLinesMoveBackwardsInSectionInTable(); void testLinesMoveBackwardsInSectionInTable();
#endif #endif
void testLinesInSectionInTable(); void testLinesInSectionInTable();
...@@ -415,6 +416,7 @@ public: ...@@ -415,6 +416,7 @@ public:
#if HAVE_MORE_FONTS #if HAVE_MORE_FONTS
CPPUNIT_TEST(testTableInSection); CPPUNIT_TEST(testTableInSection);
CPPUNIT_TEST(testTableInNestedSection); CPPUNIT_TEST(testTableInNestedSection);
CPPUNIT_TEST(testTableInSectionInTable);
CPPUNIT_TEST(testLinesMoveBackwardsInSectionInTable); CPPUNIT_TEST(testLinesMoveBackwardsInSectionInTable);
#endif #endif
CPPUNIT_TEST(testLinesInSectionInTable); CPPUNIT_TEST(testLinesInSectionInTable);
...@@ -5144,6 +5146,14 @@ void SwUiWriterTest::testTableInNestedSection() ...@@ -5144,6 +5146,14 @@ void SwUiWriterTest::testTableInNestedSection()
assertXPath(pXmlDoc, "//page[1]//section/tab", 1); assertXPath(pXmlDoc, "//page[1]//section/tab", 1);
assertXPath(pXmlDoc, "//page[2]//section/tab", 1); assertXPath(pXmlDoc, "//page[2]//section/tab", 1);
} }
void SwUiWriterTest::testTableInSectionInTable()
{
// The document has a table, containing a section, containing a nested
// table.
// This crashed the layout.
createDoc("i95698.odt");
}
#endif #endif
void SwUiWriterTest::testParagraphOfTextRange() void SwUiWriterTest::testParagraphOfTextRange()
......
...@@ -925,9 +925,21 @@ static bool lcl_FindSectionsInRow( const SwRowFrame& rRow ) ...@@ -925,9 +925,21 @@ static bool lcl_FindSectionsInRow( const SwRowFrame& rRow )
if (const SwFrame* pSectionLower = pTmpFrame->GetLower()) if (const SwFrame* pSectionLower = pTmpFrame->GetLower())
{ {
if (!pSectionLower->IsColumnFrame()) if (!pSectionLower->IsColumnFrame())
{
// Section has a single column only, try to // Section has a single column only, try to
// split that. // split that.
bRet = false; bRet = false;
for (const SwFrame* pFrame = pSectionLower; pFrame; pFrame = pFrame->GetNext())
{
if (pFrame->IsTabFrame())
{
// Section contains a table, no split in that case.
bRet = true;
break;
}
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment