sw/qa/extras/ooxmlexport/data/ooo34469-1.odt |binary sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 6 ++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-)
New commits: commit 9d0c6308be5fb086e51cb8b4b0652f3d6184fd3c Author: Caolán McNamara <[email protected]> Date: Wed Jun 3 10:20:01 2015 +0100 fix crash on export of ooo34469-1.sxw to docx Change-Id: I94a11bd24ccbc550c9fa555b1a0b5493ccd9f904 diff --git a/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt b/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt new file mode 100644 index 0000000..7cf031f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 9121588..5e18937 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -671,6 +671,12 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, "fixed-date-field.docx") } } +DECLARE_OOXMLEXPORT_TEST(testOO34469, "ooo34469-1.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport()) + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "2.9.2.Creating New files|outline"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 16068b0..25eec02 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1051,7 +1051,7 @@ void DocxAttributeOutput::EndRun() } // Write field starts - for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ) + for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin() + nFieldsInPrevHyperlink; pIt != m_Fields.end(); ) { // Add the fields starts for all but hyperlinks and TOCs if ( pIt->bOpen && pIt->pField ) @@ -1265,6 +1265,7 @@ void DocxAttributeOutput::EndRun() EndField_Impl( m_Fields.back( ) ); m_Fields.pop_back(); } + m_nFieldsInHyperlink = 0; m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; @@ -1273,12 +1274,15 @@ void DocxAttributeOutput::EndRun() m_closeHyperlinkInThisRun = false; } - if(!m_startedHyperlink) + if (!m_startedHyperlink) + { while ( m_Fields.begin() != m_Fields.end() ) { EndField_Impl( m_Fields.front( ) ); m_Fields.erase( m_Fields.begin( ) ); } + m_nFieldsInHyperlink = 0; + } } void DocxAttributeOutput::DoWriteBookmarks()
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
