diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-14 14:36:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-17 07:23:22 +0200 |
commit | db3860062ebf4109f48139c2556ff4041aff5d6e (patch) | |
tree | b6ab4df909c8922e48a9c4eefa9a8f0f6a47c41f /vcl | |
parent | 846f557fd591626931a9dadb38180786e090104c (diff) |
extend loplugin useuniqueptr to OUString pointers
Change-Id: Ieb5bab3895e1edaff497c4a1a88303ccac097edc
Reviewed-on: https://gerrit.libreoffice.org/39948
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.h | 9 | ||||
-rw-r--r-- | vcl/source/window/accessibility.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 1 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 8 |
4 files changed, 10 insertions, 16 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index b305aa865515..d5c58195f7ae 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -84,7 +84,8 @@ bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEven struct ImplWinData { - OUString* mpExtOldText; + std::unique_ptr<OUString> + mpExtOldText; std::unique_ptr<ExtTextInputAttr[]> mpExtOldAttrAry; tools::Rectangle* mpCursorRect; @@ -164,8 +165,10 @@ struct ImplFrameData struct ImplAccessibleInfos { sal_uInt16 nAccessibleRole; - OUString* pAccessibleName; - OUString* pAccessibleDescription; + std::unique_ptr<OUString> + pAccessibleName; + std::unique_ptr<OUString> + pAccessibleDescription; VclPtr<vcl::Window> pLabeledByWindow; VclPtr<vcl::Window> pLabelForWindow; VclPtr<vcl::Window> pMemberOfWindow; diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index cee8929a905a..74561cda7dc2 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -107,8 +107,6 @@ ImplAccessibleInfos::ImplAccessibleInfos() ImplAccessibleInfos::~ImplAccessibleInfos() { - delete pAccessibleName; - delete pAccessibleDescription; } namespace vcl { @@ -422,8 +420,7 @@ void Window::SetAccessibleName( const OUString& rName ) OUString oldName = GetAccessibleName(); - delete mpWindowImpl->mpAccessibleInfos->pAccessibleName; - mpWindowImpl->mpAccessibleInfos->pAccessibleName = new OUString( rName ); + mpWindowImpl->mpAccessibleInfos->pAccessibleName.reset( new OUString( rName ) ); CallEventListeners( VclEventId::WindowFrameTitleChanged, &oldName ); } @@ -504,8 +501,7 @@ void Window::SetAccessibleDescription( const OUString& rDescription ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; SAL_WARN_IF( mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "vcl", "AccessibleDescription already set!" ); - delete mpWindowImpl->mpAccessibleInfos->pAccessibleDescription; - mpWindowImpl->mpAccessibleInfos->pAccessibleDescription = new OUString( rDescription ); + mpWindowImpl->mpAccessibleInfos->pAccessibleDescription.reset( new OUString( rDescription ) ); } OUString Window::GetAccessibleDescription() const diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index cdcffdace4f8..6e35ebac9815 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -765,7 +765,6 @@ ImplWinData::ImplWinData() : ImplWinData::~ImplWinData() { - delete mpExtOldText; delete mpCursorRect; delete[] mpCompositionCharRects; delete mpFocusRect; diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index e7621bb58a40..4f5e11a6df21 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1139,7 +1139,7 @@ static bool ImplHandleExtTextInput( vcl::Window* pWindow, if ( !pChild->ImplGetWindowImpl()->mbExtTextInput ) { pChild->ImplGetWindowImpl()->mbExtTextInput = true; - pWinData->mpExtOldText = new OUString; + pWinData->mpExtOldText.reset( new OUString ); pWinData->mpExtOldAttrAry.reset(); pSVData->maWinData.mpExtTextInputWin = pChild; ImplCallCommand( pChild, CommandEventId::StartExtTextInput ); @@ -1206,11 +1206,7 @@ static bool ImplHandleEndExtTextInput() pChild->ImplGetWindowImpl()->mbExtTextInput = false; pSVData->maWinData.mpExtTextInputWin = nullptr; ImplWinData* pWinData = pChild->ImplGetWinData(); - if ( pWinData->mpExtOldText ) - { - delete pWinData->mpExtOldText; - pWinData->mpExtOldText = nullptr; - } + pWinData->mpExtOldText.reset(); pWinData->mpExtOldAttrAry.reset(); bRet = !ImplCallCommand( pChild, CommandEventId::EndExtTextInput ); } |