Kaydet (Commit) 3ff5af22 authored tarafından umeshkadam's avatar umeshkadam Kaydeden (comit) Miklos Vajna

fdo#76312: LO crashes - endTableCell is called before StartTable.

- m_oldTableReference values were not being reset.
- A call for DocxAttributeOutput::switchHeaderFooter from
  DocxExport::WriteHeadersFooters would end up using the m_oldTableReference
  value saved by DocxAttributeOutput::EndParagraph, which is incorrect.
- Fixed this issue and added an UT for the same.

Change-Id: I5ac51c3449e78bd26389e93e0d733d429dcc6874
Reviewed-on: https://gerrit.libreoffice.org/8659Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 273195cb
...@@ -2719,6 +2719,15 @@ DECLARE_OOXMLEXPORT_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx") ...@@ -2719,6 +2719,15 @@ DECLARE_OOXMLEXPORT_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[1]/m:dPr[1]/m:begChr[1]","val",""); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[1]/m:dPr[1]/m:begChr[1]","val","");
} }
DECLARE_OOXMLEXPORT_TEST(testFDO76312, "FDO76312.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]");
}
DECLARE_OOXMLEXPORT_TEST(test_FieldType, "99_Fields.docx") DECLARE_OOXMLEXPORT_TEST(test_FieldType, "99_Fields.docx")
{ {
xmlDocPtr pXmlDoc = parseExport("word/document.xml"); xmlDocPtr pXmlDoc = parseExport("word/document.xml");
......
...@@ -2490,6 +2490,9 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde ...@@ -2490,6 +2490,9 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
else if( index == -1) else if( index == -1)
{ {
*m_tableReference = *m_oldTableReference; *m_tableReference = *m_oldTableReference;
//Reset the oldReference, after copying it back to the original.
m_oldTableReference->m_bTableCellOpen = false ;
m_oldTableReference->m_nTableDepth = 0;
} }
else else
{ {
...@@ -2519,7 +2522,9 @@ void DocxAttributeOutput::EndTable() ...@@ -2519,7 +2522,9 @@ void DocxAttributeOutput::EndTable()
// We closed the table; if it is a nested table, the cell that contains it // We closed the table; if it is a nested table, the cell that contains it
// still continues // still continues
m_tableReference->m_bTableCellOpen = true; // set to true only if we were in a nested table, not otherwise.
if( 0 != tableFirstCells.size() )
m_tableReference->m_bTableCellOpen = true;
// Cleans the table helper // Cleans the table helper
delete m_pTableWrt, m_pTableWrt = NULL; delete m_pTableWrt, m_pTableWrt = NULL;
......
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