diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-03-06 10:11:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-03-06 22:17:47 +0100 |
commit | 54c6fcff19fdf9e9074bdf7b7a3f68ec398c51df (patch) | |
tree | f339e116a4ffea6c226dd1c43718114c54923828 | |
parent | 749897d308c41cd5c92eccdd9fc7a5becbcea33c (diff) |
rhbz#1810732 crash/assert inserting document with initial graphic
Change-Id: Idae665c926856922a25a1228ed34f3cae96e4bdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90085
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/uiwriter/data/rhbz1810732.docx | bin | 0 -> 12107 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 21 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 4 |
3 files changed, 24 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data/rhbz1810732.docx b/sw/qa/extras/uiwriter/data/rhbz1810732.docx Binary files differnew file mode 100644 index 000000000000..2bf1d574d491 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/rhbz1810732.docx diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e837114a1684..aab02513762f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -325,6 +325,7 @@ public: void testCreateDocxAnnotation(); void testTdf107976(); void testTdf108524(); + void testRhbz1810732(); void testTableInSection(); void testTableInNestedSection(); void testTableInSectionInTable(); @@ -534,6 +535,7 @@ public: CPPUNIT_TEST(testCreateDocxAnnotation); CPPUNIT_TEST(testTdf107976); CPPUNIT_TEST(testTdf108524); + CPPUNIT_TEST(testRhbz1810732); CPPUNIT_TEST(testTableInSection); CPPUNIT_TEST(testTableInNestedSection); CPPUNIT_TEST(testTableInSectionInTable); @@ -6178,6 +6180,25 @@ void SwUiWriterTest::testTdf113877_Standard_style() CPPUNIT_ASSERT_EQUAL(listId1, listId3); } +// just care that this does crash/assert +void SwUiWriterTest::testRhbz1810732() +{ + load(DATA_DIRECTORY, "tdf113877_blank.odt"); + + // set a page cursor into the end of the document + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToEndOfPage(); + + // insert the same document at current cursor position + { + const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "rhbz1810732.docx"; + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } })); + dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues); + } +} + void SwUiWriterTest::testTdf108524() { createDoc("tdf108524.odt"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index bc4a830bb733..cd21f22d6acd 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3819,7 +3819,9 @@ uno::Reference < lang::XMultiServiceFactory > const & DomainMapper::GetTextFacto uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange() { - return m_pImpl->GetTopTextAppend()->getEnd(); + if (m_pImpl->HasTopText()) + return m_pImpl->GetTopTextAppend()->getEnd(); + return m_pImpl->m_xInsertTextRange; } OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ) |