[Libreoffice-commits] .: 2 commits - sw/source

Michael Stahl mst at kemper.freedesktop.org
Thu Mar 22 15:13:45 PDT 2012


 sw/source/core/edit/edundo.cxx     |    4 ++++
 sw/source/core/frmedt/feshview.cxx |    8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit f24153cded54954da7f0d80941707715c78e4627
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Mar 22 23:03:05 2012 +0100

    fdo#39003: fix autoformat Undo cursors:
    
    SwEditShell::Undo: Because the Undo actions nowadays create new shell
    cursors directly (while previously they worked on a SwUndoIter), it is
    necessary to remove the shell cursor ring before Pop() because Pop(false)
    only restores the current cursor from the stack, not the rest of the ring.
    (regression from CWS undoapi, 1ba0c1878116ada5dc4ebdecdb1e0a3da9758547)

diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index 95c9252..26b64b0 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -142,6 +142,10 @@ bool SwEditShell::Undo(sal_uInt16 const nCount)
                     .getStr());
         }
 
+        if (bRestoreCrsr)
+        {   // fdo#39003 Pop does not touch the rest of the cursor ring
+            KillPams(); // so call this first to get rid of unwanted cursors
+        }
         Pop( !bRestoreCrsr );
 
         GetDoc()->SetRedlineMode( eOld );
commit 06d1d69fc8c214251cf9dbc7f87756651657d3bf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Mar 22 14:52:41 2012 +0100

    SwFEShell::ShouldObjectBeSelected leaks pPos

diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 7c6dd99..be852a9 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1163,13 +1163,13 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
                                     dynamic_cast<const SwTxtFrm*>(pCntntFrm);
                             if ( pTxtFrm )
                             {
-                                SwPosition* pPos =
-                                    new SwPosition( *(pTxtFrm->GetTxtNode()) );
+                                SwPosition aPos( *(pTxtFrm->GetTxtNode()) );
                                 Point aTmpPt( rPt );
-                                if ( pTxtFrm->GetKeyCrsrOfst( pPos, aTmpPt ) )
+                                if (pTxtFrm->GetKeyCrsrOfst(&aPos, aTmpPt))
                                 {
                                     SwRect aCursorCharRect;
-                                    if ( pTxtFrm->GetCharRect( aCursorCharRect, *pPos ) )
+                                    if (pTxtFrm->GetCharRect(aCursorCharRect,
+                                                aPos))
                                     {
                                         if ( aCursorCharRect.IsOver( SwRect( pObj->GetLastBoundRect() ) ) )
                                         {


More information about the Libreoffice-commits mailing list