summaryrefslogtreecommitdiff
path: root/vcl/win/window
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-02 15:17:52 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-02 15:17:52 +0100
commit5595ee701eab0fef0683c93e3c99788ab1b08520 (patch)
treef65921d6b5b0c8c988fa37eb4dc57e2879d25bf2 /vcl/win/window
parent19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d (diff)
loplugin:useuniqueptr
Change-Id: I3a246a22baaac8195dc1b94c42994de7d80e8336
Diffstat (limited to 'vcl/win/window')
-rw-r--r--vcl/win/window/salframe.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 689a69c0699c..d908dbc7f854 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -26,6 +26,7 @@
#include <officecfg/Office/Common.hxx>
+#include <memory>
#include <string.h>
#include <limits.h>
@@ -5010,10 +5011,9 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, nullptr, 0 ) / sizeof( WCHAR );
if ( nTextLen >= 0 )
{
- WCHAR* pTextBuf = new WCHAR[nTextLen];
- ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) );
- aEvt.maText = OUString( reinterpret_cast<const sal_Unicode*>(pTextBuf), (sal_Int32)nTextLen );
- delete [] pTextBuf;
+ auto pTextBuf = std::unique_ptr<WCHAR[]>(new WCHAR[nTextLen]);
+ ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) );
+ aEvt.maText = OUString( reinterpret_cast<const sal_Unicode*>(pTextBuf.get()), (sal_Int32)nTextLen );
}
aEvt.mnCursorPos = aEvt.maText.getLength();