diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 11:05:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 10:16:35 +0200 |
commit | 724e6822241322975dbc18e2b77723a01ac13da9 (patch) | |
tree | 3a432eb2e11cd4e5d272be05997f76ba863453d8 /vcl | |
parent | 7970cca95027cca9847202c6e8263124a4eb30a6 (diff) |
loplugin:useuniqueptr in WindowImpl
Change-Id: I6a24f9fdf574276281d4a67caec426df14b2dd8c
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/window.h | 4 | ||||
-rw-r--r-- | vcl/source/window/accessibility.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/clipping.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 4 |
4 files changed, 13 insertions, 17 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 94d0013908db..5c942db6c1e0 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -270,12 +270,12 @@ public: css::uno::Reference< css::accessibility::XAccessible > mxAccessible; std::shared_ptr< VclSizeGroup > m_xSizeGroup; std::vector< VclPtr<FixedText> > m_aMnemonicLabels; - ImplAccessibleInfos* mpAccessibleInfos; + std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos; VCLXWindow* mpVCLXWindow; vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates) vcl::Region maWinClipRegion; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates) vcl::Region maInvalidateRegion; //< region that has to be redrawn (frame coordinates) - vcl::Region* mpChildClipRegion; //< child clip region if CLIPCHILDREN is set (frame coordinates) + std::unique_ptr<vcl::Region> mpChildClipRegion; //< child clip region if CLIPCHILDREN is set (frame coordinates) vcl::Region* mpPaintRegion; //< only set during Paint() method call (window coordinates) WinBits mnStyle; WinBits mnPrevStyle; diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 4ee4b07ea89d..098044899898 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -281,7 +281,7 @@ vcl::Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) void Window::SetAccessibleRole( sal_uInt16 nRole ) { if ( !mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); SAL_WARN_IF( mpWindowImpl->mpAccessibleInfos->nAccessibleRole != 0xFFFF, "vcl", "AccessibleRole already set!" ); mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole; @@ -418,7 +418,7 @@ sal_uInt16 Window::GetAccessibleRole() const void Window::SetAccessibleName( const OUString& rName ) { if ( !mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); OUString oldName = GetAccessibleName(); @@ -500,7 +500,7 @@ OUString Window::getDefaultAccessibleName() const void Window::SetAccessibleDescription( const OUString& rDescription ) { if ( ! mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); SAL_WARN_IF( mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "vcl", "AccessibleDescription already set!" ); mpWindowImpl->mpAccessibleInfos->pAccessibleDescription.reset( new OUString( rDescription ) ); @@ -530,21 +530,21 @@ OUString Window::GetAccessibleDescription() const void Window::SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy ) { if ( !mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy; } void Window::SetAccessibleRelationLabelFor( vcl::Window* pLabelFor ) { if ( !mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor; } void Window::SetAccessibleRelationMemberOf( vcl::Window* pMemberOfWin ) { if ( !mpWindowImpl->mpAccessibleInfos ) - mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; + mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos ); mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin; } diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 922ff7104e30..9a45d03c1f08 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -265,16 +265,12 @@ void Window::ImplInitWinChildClipRegion() { if ( !mpWindowImpl->mpFirstChild ) { - if ( mpWindowImpl->mpChildClipRegion ) - { - delete mpWindowImpl->mpChildClipRegion; - mpWindowImpl->mpChildClipRegion = nullptr; - } + mpWindowImpl->mpChildClipRegion.reset(); } else { if ( !mpWindowImpl->mpChildClipRegion ) - mpWindowImpl->mpChildClipRegion = new vcl::Region( mpWindowImpl->maWinClipRegion ); + mpWindowImpl->mpChildClipRegion.reset( new vcl::Region( mpWindowImpl->maWinClipRegion ) ); else *mpWindowImpl->mpChildClipRegion = mpWindowImpl->maWinClipRegion; @@ -291,7 +287,7 @@ Region* Window::ImplGetWinChildClipRegion() if ( mpWindowImpl->mbInitChildRegion ) ImplInitWinChildClipRegion(); if ( mpWindowImpl->mpChildClipRegion ) - return mpWindowImpl->mpChildClipRegion; + return mpWindowImpl->mpChildClipRegion.get(); else return &mpWindowImpl->maWinClipRegion; } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 036034a37e77..f1ee1d744baa 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -744,8 +744,8 @@ WindowImpl::WindowImpl( WindowType nType ) WindowImpl::~WindowImpl() { - delete mpChildClipRegion; - delete mpAccessibleInfos; + mpChildClipRegion.reset(); + mpAccessibleInfos.reset(); } ImplWinData::ImplWinData() : |