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

Caolán McNamara caolanm at redhat.com
Fri Jun 26 01:10:41 PDT 2015


 sw/qa/extras/ww8export/data/fdo66304-1.odt              |binary
 sw/qa/extras/ww8export/ww8export.cxx                    |    5 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   25 ++++++++++++++++
 3 files changed, 30 insertions(+)

New commits:
commit f8bf452949881aecf64a6b68d596489c158dcf77
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 24 15:57:03 2015 +0100

    crashtesting: fix asserts on exporting fdo66304-1.odt to doc
    
    Change-Id: Ia08207143d27f88d09bd45e64ba7c3c12cd2c1a1
    (cherry picked from commit acdf113baf04263a03d574eac9a8c09f98598b7a)
    Reviewed-on: https://gerrit.libreoffice.org/16468
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ww8export/data/fdo66304-1.odt b/sw/qa/extras/ww8export/data/fdo66304-1.odt
new file mode 100644
index 0000000..c3fb9bc
Binary files /dev/null and b/sw/qa/extras/ww8export/data/fdo66304-1.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 2347fdc..e1626cd 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -529,6 +529,11 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
     }
 }
 
+DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
+{
+    //the save must survive without asserting
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 06c0c4c..4f1c396 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1961,8 +1961,33 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
         const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
         pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
 
+        SwTextNode * pOrigNode = pTNd;
+        assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
+               *aSavePam.GetPoint() == rPos);
+        assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode);
+        assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex());
+        assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex());
+
         pTNd = pTNd->SplitContentNode( rPos )->GetTextNode();
 
+        //A new node was inserted before the orig pTNd and the content up to
+        //rPos moved into it. The old node is returned with the remainder
+        //of the content in it.
+        //
+        //aSavePam was created with rPos, it continues to point to the
+        //old node, but with the *original* content index into the node.
+        //Seeing as all the orignode content before that index has
+        //been removed, the new index into the original node should now be set
+        //to 0 and the content index of rPos should also be adapted to the
+        //truncated node
+        assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
+               *aSavePam.GetPoint() == rPos);
+        assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode);
+        assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex());
+        assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex());
+        aSavePam.GetPoint()->nContent.Assign(pOrigNode, 0);
+        rPos = *aSavePam.GetMark() = *aSavePam.GetPoint();
+
         if( !pContentStore->Empty() )
             pContentStore->Restore( &m_rDoc, rPos.nNode.GetIndex()-1, 0, true );
 


More information about the Libreoffice-commits mailing list