[Libreoffice-commits] .: Branch 'libreoffice-3-6' - editeng/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jul 2 10:29:00 PDT 2012


 editeng/source/editeng/impedit3.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit efaeb259a719f3fa37e16f393f5c71124ae80a75
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 2 13:27:52 2012 -0400

    fdo#51582: Avoid double deletion of a text portion.
    
    Change-Id: Ia1c31cc8122c99a7e37bc285f61f8c5d2779b577

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 83e5689..87cdda8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -896,18 +896,19 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
             {
                 // Throw away a Portion, if necessary correct the one before,
                 // if the Hyph portion has swallowed a character ...
+                sal_uInt16 nTmpLen = pPortion->GetLen();
                 pParaPortion->GetTextPortions().Remove( nTmpPortion );
-                if ( nTmpPortion && pPortion->GetLen() )
+                if (nTmpPortion && nTmpLen)
                 {
                     nTmpPortion--;
                     TextPortion* pPrev = pParaPortion->GetTextPortions()[nTmpPortion];
                     DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
                     nTmpWidth -= pPrev->GetSize().Width();
                     nTmpPos = nTmpPos - pPrev->GetLen();
-                    pPrev->SetLen( pPrev->GetLen() + pPortion->GetLen() );
+                    pPrev->SetLen(pPrev->GetLen() + nTmpLen);
                     pPrev->GetSize().Width() = (-1);
                 }
-                delete pPortion;
+
                 DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" );
                 pPortion = pParaPortion->GetTextPortions()[nTmpPortion];
             }


More information about the Libreoffice-commits mailing list