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

Caolán McNamara caolanm at redhat.com
Sun Jan 15 20:36:50 UTC 2017


 sw/source/core/text/guess.hxx  |   14 +++++++-------
 sw/source/core/text/portxt.cxx |    3 +--
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 18a60a034abd3862ea28451f94cf2d3c7bb25307
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 15 20:33:17 2017 +0000

    crashtesting: fix a badzillion writer layout crashes
    
    e.g. fdo80788-1.odt
    
     Invalid read of size 2
        at 0x3C031438: SwLinePortion::IsParaPortion() const (porlin.hxx:132)
        by 0x3C05EC56: SwTextFormatter::BuildPortions(SwTextFormatInfo&) (itrform2.cxx:679)
        by 0x3C05F2A2: SwTextFormatter::FormatLine(int) (itrform2.cxx:1550)
    
      Address 0x3576189e is 30 bytes inside a block of size 40 free'd
        at 0x4C2ED4A: free (vg_replace_malloc.c:530)
        by 0x4E56939: rtl_freeMemory_SYSTEM(void*) (alloc_global.cxx:279)
        by 0x4E56978: rtl_freeMemory (alloc_global.cxx:349)
        by 0x4E5501B: rtl_cache_free (alloc_cache.cxx:1230)
        by 0xDACE741: FixedMemPool::Free(void*) (mempool.cxx:49)
        by 0x3C043AB8: SwTextPortion::operator delete(void*, unsigned long) (portxt.hxx:55)
        by 0x3C043B05: SwHangingPortion::~SwHangingPortion() (porrst.hxx:98)
        by 0x3C043F47: std::default_delete<SwHangingPortion>::operator()(SwHangingPortion*) const (unique_ptr.h:76)
        by 0x3C044070: std::unique_ptr<SwHangingPortion, std::default_delete<SwHangingPortion> >::reset(SwHangingPortion*) (unique_ptr.h:344)
        by 0x3C0888C3: std::unique_ptr<SwHangingPortion, std::default_delete<SwHangingPortion> >::operator=(decltype(nullptr)) (unique_ptr.h:280)
        by 0x3C0888DB: SwTextGuess::ClearHangingPortion() (guess.hxx:51)
    
    since...
    
    commit a706bb06d5326e7a997dd1d71f3f947bd0ad28e6
    Date:   Wed Jan 11 14:26:47 2017 +0200
    
        new loplugin: useuniqueptr: sw part 1
    
    Change-Id: I614029474d684ddcccd4f4a5e9787fe6c19d8fd2

diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index 9fd797d..feea8af 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -48,7 +48,7 @@ public:
     bool AlternativeSpelling( const SwTextFormatInfo &rInf, const sal_Int32 nPos );
 
     SwHangingPortion* GetHangingPortion() const { return pHanging.get(); }
-    void ClearHangingPortion() { pHanging = nullptr; }
+    SwHangingPortion* ReleaseHangingPortion() { return pHanging.release(); }
     sal_uInt16 BreakWidth() const { return nBreakWidth; }
     sal_Int32 CutPos() const { return nCutPos; }
     sal_Int32 BreakStart() const { return nBreakStart; }
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 2c200c0..bd32236 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -340,9 +340,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
     {
         Width( aGuess.BreakWidth() );
         SetLen( aGuess.BreakPos() - rInf.GetIdx() );
-        Insert( aGuess.GetHangingPortion() );
         aGuess.GetHangingPortion()->SetAscent( GetAscent() );
-        aGuess.ClearHangingPortion();
+        Insert( aGuess.ReleaseHangingPortion() );
     }
     // breakPos >= index
     else if ( aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != COMPLETE_STRING )
commit e50b785b5eeb7a3f3deedf1125c205d6abec8ac3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 15 20:29:36 2017 +0000

    ditch the irritating inline keyword
    
    Change-Id: I65cdb5a5ba3e5d1ebb852b7e0d3d58b2b2fbbbcd

diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index 75bc915..9fd797d 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -47,13 +47,13 @@ public:
                     const sal_uInt16 nHeight );
     bool AlternativeSpelling( const SwTextFormatInfo &rInf, const sal_Int32 nPos );
 
-    inline SwHangingPortion* GetHangingPortion() const { return pHanging.get(); }
-    inline void ClearHangingPortion() { pHanging = nullptr; }
-    inline sal_uInt16 BreakWidth() const { return nBreakWidth; }
-    inline sal_Int32 CutPos() const { return nCutPos; }
-    inline sal_Int32 BreakStart() const { return nBreakStart; }
-    inline sal_Int32 BreakPos() const {return nBreakPos; }
-    inline sal_Int32 FieldDiff() const {return nFieldDiff; }
+    SwHangingPortion* GetHangingPortion() const { return pHanging.get(); }
+    void ClearHangingPortion() { pHanging = nullptr; }
+    sal_uInt16 BreakWidth() const { return nBreakWidth; }
+    sal_Int32 CutPos() const { return nCutPos; }
+    sal_Int32 BreakStart() const { return nBreakStart; }
+    sal_Int32 BreakPos() const {return nBreakPos; }
+    sal_Int32 FieldDiff() const {return nFieldDiff; }
     const css::uno::Reference< css::linguistic2::XHyphenatedWord >& HyphWord() const
         { return xHyphWord; }
 };


More information about the Libreoffice-commits mailing list