summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-25 22:42:16 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-26 19:29:36 +0000
commit273be431c62aaf5fabe218cae57e8f3f9fe049e1 (patch)
tree973d0033434a8e0feaaa9f41f9e8ece72f8d9673 /vcl
parent65bdad52a04dc1f5d771bdfdc8bce23e9ba74296 (diff)
vcl: OutputDevice::GetTextArray() should always init pDXAry
CppunitTest_writerperfect_writer file libmwaw/pass/Acta_1.0.hqx uses the font "Courier", and for unknown reasons we can't properly load that font, because the PhysicalFontFamily::mpFirst for "courier" is null. This causes OutputDevice::GetTextArray() to fail to create a SalLayout and return early before initializing the passed pDXAry, which then generates lots of DrMemory warnings. Let's hope the callers are happy about an all-0 pDXAry. Change-Id: I07b29a59660cf5cd060fd77da5d96021f9d8f9f5 (cherry picked from commit e6e409b684f9b046dcde9f0615018508f769c369) Reviewed-on: https://gerrit.libreoffice.org/20206 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/text.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index faf8fa966d74..173aa5278b3b 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1007,7 +1007,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry,
}
if( nIndex >= rStr.getLength() )
- return 0;
+ return 0; // TODO: this looks like a buggy caller?
if( nLen < 0 || nIndex + nLen >= rStr.getLength() )
{
@@ -1017,7 +1017,19 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry,
SalLayout *const pSalLayout = ImplLayout(rStr, nIndex, nLen,
Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache);
if( !pSalLayout )
+ {
+ // The caller expects this to init the elements of pDXAry.
+ // Adapting all the callers to check that GetTextArray succeeded seems
+ // too much work.
+ // Init here to 0 only in the (rare) error case, so that any missing
+ // element init in the happy case will still be found by tools,
+ // and hope that is sufficient.
+ if (pDXAry)
+ {
+ memset(pDXAry, 0, nLen * sizeof(*pDXAry));
+ }
return 0;
+ }
#if VCL_FLOAT_DEVICE_PIXEL
DeviceCoordinate* pDXPixelArray = NULL;
if(pDXAry)