diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-02 20:05:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-04 08:17:06 +0200 |
commit | d4dc6b5cfdb02ad00a06ad32650948648abe010d (patch) | |
tree | 02446cd93e68aba9b78db6eb7fc902e782c6faf9 /svx/source/customshapes | |
parent | 86fa9c907387e96c9c93f1e17239730271fedbfd (diff) |
use std::vector for fetching DX array data
because I'm trying to track down a related heap corruption, and that is
much easier if the access to the array is checked by the std::vector
debug runtime
Change-Id: Ia665f5cebb7f14d88942e88b4b400ad3c28ef5d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121527
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 5863c61aee04..6e737916f97c 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -312,7 +312,6 @@ static void GetTextAreaOutline( const SvxCharScaleWidthItem& rCharScaleWidthItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTWIDTH ); sal_uInt16 nCharScaleWidth = rCharScaleWidthItem.GetValue(); - std::unique_ptr<tools::Long[]> pDXArry; sal_Int32 nWidth = 0; // VERTICAL @@ -326,7 +325,7 @@ static void GetTextAreaOutline( { FWCharacterData aCharacterData; OUString aCharText( rText[ i ] ); - if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, nWidth, pDXArry.get() ) ) + if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, nWidth, nullptr ) ) { sal_Int32 nTextWidth = pVirDev->GetTextWidth( aCharText); if ( aCharacterData.vOutlines.empty() ) @@ -363,16 +362,16 @@ static void GetTextAreaOutline( } else { + std::vector<tools::Long> aDXArry; if ( ( nCharScaleWidth != 100 ) && nCharScaleWidth ) { // applying character spacing - pDXArry.reset(new tools::Long[ rText.getLength() ]); - pVirDev->GetTextArray( rText, pDXArry.get()); + pVirDev->GetTextArray( rText, &aDXArry); FontMetric aFontMetric( pVirDev->GetFontMetric() ); aFont.SetAverageFontWidth( static_cast<sal_Int32>( static_cast<double>(aFontMetric.GetAverageFontWidth()) * ( double(100) / static_cast<double>(nCharScaleWidth) ) ) ); pVirDev->SetFont( aFont ); } FWCharacterData aCharacterData; - if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, nWidth, pDXArry.get() ) ) + if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, nWidth, aDXArry.empty() ? nullptr : aDXArry.data() ) ) { rParagraph.vCharacters.push_back( aCharacterData ); } |