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

Caolán McNamara caolanm at redhat.com
Thu Jun 18 13:37:26 PDT 2015


 sw/source/core/frmedt/fecopy.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ff6fb90179f1aa70e9d83bf4d90848fa13ff87db
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 16 19:57:15 2015 +0100

    Resolves: tdf#81806 crash on certain table paste+undo+page cycles
    
    Undo of a delete always leaves a pam that points to the start of the undone
    area and a mark to the end of the undone area, even if that area is empty. (In
    the normal where there is a selection this can be seen by selecting something,
    deleting it, and undoing and the newly undeleted stuff is again selected)
    
    The table overwrite/paste thing looks to see if a mark is set and goes off to
    "do something very complex" if its set. So if after each undo cycle, you
    physically click at the point where the cursor is flashing (which clears the
    mark) and then paste, undo, *click*, paste you get a wonderfully stable
    experience.
    
    It seems reasonable to me to "do the simple thing" if there is no mark, or if
    the mark and point are the same, i.e. there is nothing actually selected by the
    PaM.
    
    (cherry picked from commit e06905df15ff03c6d3c84f61bd67860a91416c2d)
    (cherry picked from commit 5fbf5b10ca45528a075aba5d5f8e3f6af08c287f)
    
    Change-Id: Ib451090f3863fde41209cc1fc9cfa0c747d0be58
    Reviewed-on: https://gerrit.libreoffice.org/16321
    Reviewed-by: Muthu Subramanian K <muthusuba at gmail.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 08bf192..19a407c 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -667,6 +667,11 @@ namespace {
     typedef boost::shared_ptr<SwPaM> PaMPtr;
     typedef boost::shared_ptr<SwPosition> PositionPtr;
     typedef std::pair< PaMPtr, PositionPtr > Insertion;
+
+    bool PamHasSelection(const SwPaM& rPaM)
+    {
+        return rPaM.HasMark() && *rPaM.GetPoint() != *rPaM.GetMark();
+    }
 }
 
 bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
@@ -836,7 +841,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
                 ParkTblCrsr();
                 bParkTblCrsr = true;
             }
-            else if( !PCURCRSR->HasMark() && PCURCRSR->GetNext() == PCURCRSR &&
+            else if( !PamHasSelection(*PCURCRSR) && PCURCRSR->GetNext() == PCURCRSR &&
                      ( !pSrcNd->GetTable().IsTblComplex() ||
                        pDestNd->GetTable().IsNewModel() ) )
             {


More information about the Libreoffice-commits mailing list