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>
This commit is contained in:
Caolán McNamara 2020-03-06 10:11:48 +00:00
parent 749897d308
commit 54c6fcff19
3 changed files with 24 additions and 1 deletions

Binary file not shown.

View file

@ -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");

View file

@ -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 )