[Libreoffice-commits] core.git: 3 commits - sal/osl sw/inc sw/qa sw/source

Michael Stahl mstahl at redhat.com
Thu Apr 30 15:59:33 PDT 2015


 sal/osl/unx/mutex.cxx         |    6 +++---
 sw/inc/ndindex.hxx            |    4 ++--
 sw/qa/core/macros-test.cxx    |   31 +++++++++++++++++++++++++++++++
 sw/source/core/undo/undel.cxx |    6 +++++-
 4 files changed, 41 insertions(+), 6 deletions(-)

New commits:
commit 71fe119048601cbc03f233ffcb7354a2c682185d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 30 23:21:33 2015 +0200

    sw: delete these unwanted SwNodeIndex ctors
    
    Change-Id: I289900b998c5a25307b76efb723aaf12dd6431b1

diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 986b84a..5223194 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -37,8 +37,8 @@ class SW_DLLPUBLIC SwNodeIndex SAL_FINAL : public sw::Ring<SwNodeIndex>
     SwNode* pNd;
 
     // These are not allowed!
-    SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx );
-    SwNodeIndex( SwNodes& rNds, int nIdx );
+    SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx ) SAL_DELETED_FUNCTION;
+    SwNodeIndex( SwNodes& rNds, int nIdx ) SAL_DELETED_FUNCTION;
     void RegisterIndex( SwNodes& rNodes )
     {
         if(!rNodes.vIndices)
commit c7fb1d8334d2289906ac2a0a8c32946493d10e00
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 30 23:14:02 2015 +0200

    tdf#90816: sw: fix bookmark loss in SwUndoDelete
    
    _DelBookmarks() will actually delete marks that exactly match both start
    and end position of the range, so restrict the call to only the
    fully-deleted nodes that will be moved to the Undo-array.
    
    (regression from 370febbf19a5f362394d1c9e69b12dcb218f6501)
    
    Change-Id: Icf5097774aa55ee152a1e20c0c7264330955c615

diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 26647c8..c754bb4 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -79,6 +79,7 @@ public:
     void testVba();
 #endif
     void testBookmarkDeleteAndJoin();
+    void testBookmarkDeleteTdf90816();
 #if 0
     void testControlShapeGrouping();
 #endif
@@ -93,6 +94,7 @@ public:
     CPPUNIT_TEST(testVba);
 #endif
     CPPUNIT_TEST(testBookmarkDeleteAndJoin);
+    CPPUNIT_TEST(testBookmarkDeleteTdf90816);
 #if 0
     CPPUNIT_TEST(testControlShapeGrouping);
 #endif
@@ -222,6 +224,35 @@ void SwMacrosTest::testBookmarkDeleteAndJoin()
     }
 }
 
+void SwMacrosTest::testBookmarkDeleteTdf90816()
+{
+    SwDoc *const pDoc = new SwDoc;
+    pDoc->GetIDocumentUndoRedo().DoUndo(true); // bug is in SwUndoDelete
+    SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
+    SwPaM aPaM(aIdx);
+
+    IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
+    rIDCO.AppendTxtNode(*aPaM.GetPoint());
+    rIDCO.InsertString(aPaM, OUString("ABC"));
+    aPaM.Move(fnMoveBackward, fnGoCntnt);
+    aPaM.SetMark();
+    aPaM.Move(fnMoveBackward, fnGoCntnt);
+    IDocumentMarkAccess & rIDMA = *pDoc->getIDocumentMarkAccess();
+    sw::mark::IMark *pMark =
+        rIDMA.makeMark(aPaM, "test", IDocumentMarkAccess::MarkType::BOOKMARK);
+    CPPUNIT_ASSERT(pMark);
+
+    // delete the same selection as the bookmark
+    rIDCO.DeleteAndJoin(aPaM, false);
+
+    // bookmark still there?
+    auto iter = rIDMA.getAllMarksBegin();
+    CPPUNIT_ASSERT_MESSAGE("the bookmark was deleted",
+            iter != rIDMA.getAllMarksEnd());
+    CPPUNIT_ASSERT(*aPaM.Start() == (*iter)->GetMarkPos());
+    CPPUNIT_ASSERT(*aPaM.End() == (*iter)->GetOtherMarkPos());
+}
+
 #if 0
 void SwMacrosTest::testControlShapeGrouping()
 {
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 1bbab98..51999e7 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -154,7 +154,11 @@ SwUndoDelete::SwUndoDelete(
     {
         DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
         ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
-        _DelBookmarks(pStt->nNode, pEnd->nNode, nullptr, &pStt->nContent, &pEnd->nContent);
+        if (nEndNode - nSttNode > 1) // check for fully selected nodes
+        {
+            SwNodeIndex const start(pStt->nNode, +1);
+            _DelBookmarks(start, pEnd->nNode);
+        }
     }
 
     nSetPos = pHistory ? pHistory->Count() : 0;
commit f70ae550ebbfaec629abaacff037d2798aa4b677
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 30 22:49:16 2015 +0200

    sal: disable some over-eager SAL_INFO
    
    These call malloc so often that valgrind forgets where the things i'm
    looking for were freed, because the address has already been re-used.
    
    Change-Id: I8e1a0f739a774972d3afe750250ee79262c79b85

diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 0f5f751..d822078 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -96,7 +96,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
 {
     SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
 
-    SAL_INFO("sal.osl.mutex", "osl_acquireMutex(" << pMutex << ")");
+//    SAL_INFO("sal.osl.mutex", "osl_acquireMutex(" << pMutex << ")");
 
     if ( pMutex != 0 )
     {
@@ -129,7 +129,7 @@ sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutexImpl *pMutex)
             result = true;
     }
 
-    SAL_INFO("sal.osl.mutex", "osl_tryToAcquireMutex(" << pMutex << "): " << (result ? "YES" : "NO"));
+//    SAL_INFO("sal.osl.mutex", "osl_tryToAcquireMutex(" << pMutex << "): " << (result ? "YES" : "NO"));
 
     return result;
 }
@@ -138,7 +138,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutexImpl *pMutex)
 {
     SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
 
-    SAL_INFO("sal.osl.mutex", "osl_releaseMutex(" << pMutex << ")");
+//    SAL_INFO("sal.osl.mutex", "osl_releaseMutex(" << pMutex << ")");
 
     if ( pMutex )
     {


More information about the Libreoffice-commits mailing list