[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 13 02:55:16 PDT 2014


 sw/qa/extras/uiwriter/data/fdo75110.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx      |   15 +++++++++++++++
 sw/source/core/edit/eddel.cxx           |    9 +++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit fea99d32aec1c24b7cbc7a4063b21a471072509b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 12 17:28:10 2014 +0100

    fdo#75110 SwEditShell::DeleteSel fix start of selection when bSelAll == true
    
    (cherry picked from commit f9b62506b22c3eb885ffd5a4ec8025c33df7b2d4)
    
    Conflicts:
    	sw/qa/extras/uiwriter/uiwriter.cxx
    
    Change-Id: I3e8ce585b29619061b18ab1ab8f0cf6c7d421074
    Reviewed-on: https://gerrit.libreoffice.org/8559
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/qa/extras/uiwriter/data/fdo75110.odt b/sw/qa/extras/uiwriter/data/fdo75110.odt
new file mode 100644
index 0000000..f4c2f2b
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo75110.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 12c76b8..a86d2ca 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -23,11 +23,13 @@ public:
     //EDITING: undo search&replace corrupt text when searching backward
     void testReplaceBackward();
     void testFdo69893();
+    void testFdo75110();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
     CPPUNIT_TEST(testReplaceBackward);
     CPPUNIT_TEST(testFdo69893);
+    CPPUNIT_TEST(testFdo75110);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -78,6 +80,19 @@ void SwUiWriterTest::testReplaceForward()
     CPPUNIT_ASSERT_EQUAL(ORIGINAL_REPLACE_CONTENT, pTxtNode->GetTxt());
 }
 
+void SwUiWriterTest::testFdo75110()
+{
+    SwDoc* pDoc = createDoc("fdo75110.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+    pWrtShell->SelAll();
+    // The problem was that SwEditShell::DeleteSel() what this Delete() invokes took the wrong selection...
+    pWrtShell->Delete();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    // ... so this Undo() call resulted in a crash.
+    rUndoManager.Undo();
+}
+
 void SwUiWriterTest::testReplaceBackward()
 {
     SwDoc* pDoc = createDoc();
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index e94ea3b..6a4fc87 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -89,9 +89,14 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
     }
     else
     {
+        SwPaM aPam(rPam);
+        if (bSelectAll)
+            // Selection starts at the first para of the first cell, but we
+            // want to delete the table node before the first cell as well.
+            aPam.Start()->nNode = aPam.Start()->nNode.GetNode().FindTableNode()->GetIndex();
         // delete everything
-        GetDoc()->DeleteAndJoin( rPam );
-        SaveTblBoxCntnt( rPam.GetPoint() );
+        GetDoc()->DeleteAndJoin( aPam );
+        SaveTblBoxCntnt( aPam.GetPoint() );
     }
 
     // Selection is not needed anymore


More information about the Libreoffice-commits mailing list