summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-02-24 09:53:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-24 10:07:55 +0100
commitb258aec6cff0036397ee4115e08f677ba77797a0 (patch)
tree9d876d400dbb52de15bda07f045a29647020d481 /vcl
parent00c1d85fabe426efdf6833b8034b041f1263d702 (diff)
use unique_ptr in ImplHandleIMECompositionInput
Change-Id: I9587d97fbdd73844590fd6380e594ec7b4f4df14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/window/salframe.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 3454ebf885c8..0d211d3bf3f2 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5045,7 +5045,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
bDef = false;
- ExtTextInputAttr* pSalAttrAry = nullptr;
+ std::unique_ptr<ExtTextInputAttr[]> pSalAttrAry;
LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, nullptr, 0 ) / sizeof( WCHAR );
if ( nTextLen > 0 )
{
@@ -5066,8 +5066,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
if ( pAttrBuf )
{
sal_Int32 nTextLen2 = aEvt.maText.getLength();
- pSalAttrAry = new ExtTextInputAttr[nTextLen2];
- memset( pSalAttrAry, 0, nTextLen2*sizeof( sal_uInt16 ) );
+ pSalAttrAry.reset(new ExtTextInputAttr[nTextLen2]);
+ memset( pSalAttrAry.get(), 0, nTextLen2*sizeof( sal_uInt16 ) );
for( sal_Int32 i = 0; (i < nTextLen2) && (i < nAttrLen); i++ )
{
BYTE nWinAttr = pAttrBuf.get()[i];
@@ -5088,7 +5088,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
pSalAttrAry[i] = nSalAttr;
}
- aEvt.mpTextAttr = pSalAttrAry;
+ aEvt.mpTextAttr = pSalAttrAry.get();
}
}
@@ -5123,9 +5123,6 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
}
ImplUpdateIMECursorPos( pFrame, hIMC );
}
-
- if ( pSalAttrAry )
- delete [] pSalAttrAry;
}
return !bDef;