[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/qa sw/source

Gabor Kelemen (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 22 09:21:21 UTC 2021


 dev/null                             |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx  |   31 -------------------------------
 sw/source/core/doc/textboxhelper.cxx |    7 +------
 3 files changed, 1 insertion(+), 37 deletions(-)

New commits:
commit f2a722387b9355e6907b33f08afa71735e83c6ba
Author:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Thu Apr 22 11:11:08 2021 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Apr 22 11:20:47 2021 +0200

    Revert "tdf#137802 sw: fix crash on deleting last paragraph"
    
    This reverts commit f9a26bd2f5fae14ed99d8240a090b9a5aae1fcc2.
    
    Reason for revert: Could not cherrypick the other changes of the same bug and this causes regression
    
    Change-Id: I912d47379f020694e8158f279b9fd222335d7ac8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114427
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/uiwriter/data3/txbx_crash.odt b/sw/qa/extras/uiwriter/data3/txbx_crash.odt
deleted file mode 100755
index 0a029da88289..000000000000
Binary files a/sw/qa/extras/uiwriter/data3/txbx_crash.odt and /dev/null differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 60e2d5067166..245c57ebb788 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -772,37 +772,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107893)
     CPPUNIT_ASSERT_MESSAGE("Textbox cannot be readd after Undo!", pTxBxFrm);
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, TestTextBoxCrashAfterLineDel)
-{
-    // Open the desired file
-    load(DATA_DIRECTORY, "txbx_crash.odt");
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-
-    // Get the Writer shell
-    SwWrtShell* pWrtSh = pTextDoc->GetDocShell()->GetWrtShell();
-    CPPUNIT_ASSERT(pWrtSh);
-
-    // Get the format of the shape
-    const SwFrameFormats& rFrmFormats = *pWrtSh->GetDoc()->GetSpzFrameFormats();
-    CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1)));
-    SwFrameFormat* pShape = rFrmFormats.front();
-    CPPUNIT_ASSERT(pShape);
-
-    // Add a textbox
-    SwTextBoxHelper::create(pShape);
-    SwFrameFormat* pTxBxFrm = SwTextBoxHelper::getOtherTextBoxFormat(getShape(1));
-    CPPUNIT_ASSERT(pTxBxFrm);
-
-    // remove the last paragraph
-    auto xCursor = getParagraph(1)->getText()->createTextCursor();
-    xCursor->gotoEnd(false);
-    xCursor->goLeft(3, true);
-
-    // This caused crash before, now it should pass with the patch.
-    xCursor->setString(OUString());
-}
-
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067)
 {
     mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 2fc1c1474ff6..ce695048276f 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -91,12 +91,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText)
     }
     catch (uno::Exception&)
     {
-        // Before the textframe was appended now it is inserted to the begin of the doc in order
-        // to prevent crash when someone removes the para where the textframe anchored:
-        uno::Reference<text::XTextCursor> xCursor = xTextDocument->getText()->createTextCursor();
-        xCursor->gotoStart(false);
-        xTextContentAppend->insertTextContentWithProperties(
-            xTextFrame, uno::Sequence<beans::PropertyValue>(), xCursor->getStart());
+        xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
     }
     // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
     uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);


More information about the Libreoffice-commits mailing list