summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-01 22:56:37 +0200
committerMichael Stahl <mstahl@redhat.com>2014-08-02 19:09:43 +0200
commit6defffea57ba803a47fd10d1496e0c5c477009c8 (patch)
treef57cf87f5a9f3c3da0ce6f5874ae2ec0c85e5248 /vcl
parentb46956e73b6daff2578110c0395fd80150dc0b0b (diff)
vcl: evidently a little more type safety is required here
MultiSalLayout::AdjustLayout() crashes with mangled stack. (regression from 2b8528a2745bec7909bfe2265d6110a9964eef47) Change-Id: I20b7980dd89dd1b72063c2187ac3a4735babc4c4
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/sallayout.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 8faddc5271e3..21ee47f898af 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1523,6 +1523,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
SalLayout::AdjustLayout( rArgs );
ImplLayoutArgs aMultiArgs = rArgs;
+ boost::scoped_array<DeviceCoordinate> pJustificationArray;
if( !rArgs.mpDXArray && rArgs.mnLayoutWidth )
{
@@ -1537,8 +1538,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
mpLayouts[n]->SalLayout::AdjustLayout( aMultiArgs );
// then we can measure the unmodified metrics
int nCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
- DeviceCoordinate* pJustificationArray = (DeviceCoordinate*)alloca( nCharCount * sizeof(sal_Int32) );
- FillDXArray( pJustificationArray );
+ pJustificationArray.reset(new DeviceCoordinate[nCharCount]);
+ FillDXArray( pJustificationArray.get() );
// #i17359# multilayout is not simplified yet, so calculating the
// unjustified width needs handholding; also count the number of
// stretchable virtual char widths
@@ -1585,8 +1586,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
}
}
- // change the mpDXArray temporarilly (just for the justification)
- aMultiArgs.mpDXArray = pJustificationArray;
+ // change the mpDXArray temporarily (just for the justification)
+ aMultiArgs.mpDXArray = pJustificationArray.get();
}
}