summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-13 20:42:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-14 10:13:46 +0200
commit8e39ef66928a3e37c618d3a70a631e71266db274 (patch)
tree8cab0264e58c885ae7d78a77d90fd041bcdbe15d /vcl
parentd7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff)
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781 Reviewed-on: https://gerrit.libreoffice.org/39932 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/window.h12
-rw-r--r--vcl/source/window/window.cxx1
-rw-r--r--vcl/source/window/winproc.cxx22
3 files changed, 12 insertions, 23 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index c55f650b6e2b..b305aa865515 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -27,6 +27,7 @@
#include <o3tl/typed_flags_set.hxx>
#include <list>
+#include <memory>
#include <vector>
#include <set>
@@ -84,14 +85,15 @@ bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEven
struct ImplWinData
{
OUString* mpExtOldText;
- ExtTextInputAttr* mpExtOldAttrAry;
- tools::Rectangle* mpCursorRect;
+ std::unique_ptr<ExtTextInputAttr[]>
+ mpExtOldAttrAry;
+ tools::Rectangle* mpCursorRect;
long mnCursorExtWidth;
bool mbVertical;
- tools::Rectangle* mpCompositionCharRects;
+ tools::Rectangle* mpCompositionCharRects;
long mnCompositionCharRects;
- tools::Rectangle* mpFocusRect;
- tools::Rectangle* mpTrackRect;
+ tools::Rectangle* mpFocusRect;
+ tools::Rectangle* mpTrackRect;
ShowTrackFlags mnTrackFlags;
sal_uInt16 mnIsTopWindow;
bool mbMouseOver; //< tracks mouse over for native widget paint effect
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 8ce275cef20a..cdcffdace4f8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -766,7 +766,6 @@ ImplWinData::ImplWinData() :
ImplWinData::~ImplWinData()
{
delete mpExtOldText;
- delete mpExtOldAttrAry;
delete mpCursorRect;
delete[] mpCompositionCharRects;
delete mpFocusRect;
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 9cfb68742127..e7621bb58a40 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1140,11 +1140,7 @@ static bool ImplHandleExtTextInput( vcl::Window* pWindow,
{
pChild->ImplGetWindowImpl()->mbExtTextInput = true;
pWinData->mpExtOldText = new OUString;
- if ( pWinData->mpExtOldAttrAry )
- {
- delete [] pWinData->mpExtOldAttrAry;
- pWinData->mpExtOldAttrAry = nullptr;
- }
+ pWinData->mpExtOldAttrAry.reset();
pSVData->maWinData.mpExtTextInputWin = pChild;
ImplCallCommand( pChild, CommandEventId::StartExtTextInput );
}
@@ -1190,15 +1186,11 @@ static bool ImplHandleExtTextInput( vcl::Window* pWindow,
nCursorPos, nCursorFlags,
bOnlyCursor );
*pWinData->mpExtOldText = rText;
- if ( pWinData->mpExtOldAttrAry )
- {
- delete [] pWinData->mpExtOldAttrAry;
- pWinData->mpExtOldAttrAry = nullptr;
- }
+ pWinData->mpExtOldAttrAry.reset();
if ( pTextAttr )
{
- pWinData->mpExtOldAttrAry = new ExtTextInputAttr[rText.getLength()];
- memcpy( pWinData->mpExtOldAttrAry, pTextAttr, rText.getLength()*sizeof( ExtTextInputAttr ) );
+ pWinData->mpExtOldAttrAry.reset( new ExtTextInputAttr[rText.getLength()] );
+ memcpy( pWinData->mpExtOldAttrAry.get(), pTextAttr, rText.getLength()*sizeof( ExtTextInputAttr ) );
}
return !ImplCallCommand( pChild, CommandEventId::ExtTextInput, &aData );
}
@@ -1219,11 +1211,7 @@ static bool ImplHandleEndExtTextInput()
delete pWinData->mpExtOldText;
pWinData->mpExtOldText = nullptr;
}
- if ( pWinData->mpExtOldAttrAry )
- {
- delete [] pWinData->mpExtOldAttrAry;
- pWinData->mpExtOldAttrAry = nullptr;
- }
+ pWinData->mpExtOldAttrAry.reset();
bRet = !ImplCallCommand( pChild, CommandEventId::EndExtTextInput );
}