[Libreoffice-commits] core.git: sw/qa writerfilter/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 21:18:21 UTC 2020


 sw/qa/extras/uiwriter/data/rhbz1810732.docx  |binary
 sw/qa/extras/uiwriter/uiwriter.cxx           |   21 +++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    4 +++-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 54c6fcff19fdf9e9074bdf7b7a3f68ec398c51df
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 6 10:11:48 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 6 22:17:47 2020 +0100

    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 at redhat.com>

diff --git a/sw/qa/extras/uiwriter/data/rhbz1810732.docx b/sw/qa/extras/uiwriter/data/rhbz1810732.docx
new file mode 100644
index 000000000000..2bf1d574d491
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/rhbz1810732.docx differ
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 )


More information about the Libreoffice-commits mailing list