include/vcl/dockingarea.hxx | 3 ++- include/vcl/vclmedit.hxx | 7 ++++--- vcl/inc/brdwin.hxx | 2 +- vcl/source/edit/vclmedit.cxx | 13 ++++--------- vcl/source/window/brdwin.cxx | 15 +++++++-------- vcl/source/window/dockingarea.cxx | 4 ++-- 6 files changed, 20 insertions(+), 24 deletions(-)
New commits: commit 58aab71b34327e71b27287b59b9e1d652bf316c3 Author: Noel Grandin <[email protected]> Date: Fri Apr 13 09:59:38 2018 +0200 loplugin:useuniqueptr in DockingAreaWindow Change-Id: I20fb393cfe4a129bc1007d00df5671c784ae85e4 Reviewed-on: https://gerrit.libreoffice.org/52891 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx index 2a178f530e5d..6f6e045c1451 100644 --- a/include/vcl/dockingarea.hxx +++ b/include/vcl/dockingarea.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_DOCKINGAREA_HXX #include <vcl/window.hxx> +#include <memory> // A simple container for docked toolbars // - its main purpose is theming support @@ -29,7 +30,7 @@ class VCL_DLLPUBLIC DockingAreaWindow : public vcl::Window class ImplData; private: - ImplData* mpImplData; + std::unique_ptr<ImplData> mpImplData; DockingAreaWindow (const DockingAreaWindow &) = delete; DockingAreaWindow & operator= (const DockingAreaWindow &) = delete; diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 4d01b3625e0c..647f87bf3d36 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -44,7 +44,7 @@ DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) : { ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, nullptr ); - mpImplData = new ImplData; + mpImplData.reset(new ImplData); } DockingAreaWindow::~DockingAreaWindow() @@ -54,7 +54,7 @@ DockingAreaWindow::~DockingAreaWindow() void DockingAreaWindow::dispose() { - delete mpImplData; + mpImplData.reset(); Window::dispose(); } commit 96e5d09224d46641278d995dc5fd463fac3dfa75 Author: Noel Grandin <[email protected]> Date: Fri Apr 13 09:58:07 2018 +0200 loplugin:useuniqueptr in ImplBorderWindow Change-Id: Iabff2048cd3f990fe359b8a281a1eb3af2bb9c32 Reviewed-on: https://gerrit.libreoffice.org/52890 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index 36292b21e963..8e3846a07c74 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -82,7 +82,7 @@ class ImplBorderWindow : public vcl::Window friend class ImplStdBorderWindowView; private: - ImplBorderWindowView* mpBorderView; + std::unique_ptr<ImplBorderWindowView> mpBorderView; VclPtr<vcl::Window> mpMenuBarWindow; VclPtr<NotebookBar> mpNotebookBar; long mnMinWidth; diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 0b027196db8f..594b7471d038 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1666,8 +1666,7 @@ ImplBorderWindow::~ImplBorderWindow() void ImplBorderWindow::dispose() { - delete mpBorderView; - mpBorderView = nullptr; + mpBorderView.reset(); mpMenuBarWindow.clear(); mpNotebookBar.disposeAndClear(); vcl::Window::dispose(); @@ -1834,18 +1833,18 @@ void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) void ImplBorderWindow::InitView() { if ( mbSmallOutBorder ) - mpBorderView = new ImplSmallBorderWindowView( this ); + mpBorderView.reset(new ImplSmallBorderWindowView( this )); else if ( mpWindowImpl->mbFrame ) { if( mbFrameBorder ) - mpBorderView = new ImplStdBorderWindowView( this ); + mpBorderView.reset(new ImplStdBorderWindowView( this )); else - mpBorderView = new ImplNoBorderWindowView; + mpBorderView.reset(new ImplNoBorderWindowView); } else if ( !mbFrameBorder ) - mpBorderView = new ImplSmallBorderWindowView( this ); + mpBorderView.reset(new ImplSmallBorderWindowView( this )); else - mpBorderView = new ImplStdBorderWindowView( this ); + mpBorderView.reset(new ImplStdBorderWindowView( this )); Size aSize = GetOutputSizePixel(); mpBorderView->Init( this, aSize.Width(), aSize.Height() ); } @@ -1861,7 +1860,7 @@ void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize ) if ( bNewView ) { - delete mpBorderView; + mpBorderView.reset(); InitView(); } else commit 1e9101e7bd2d423416fcf1cb1c1b15a140aa12e6 Author: Noel Grandin <[email protected]> Date: Fri Apr 13 09:52:58 2018 +0200 loplugin:useuniqueptr in VclMultiLineEdit Change-Id: I386aa427e12cc97bd116102b1cc75fd7c0d56d61 Reviewed-on: https://gerrit.libreoffice.org/52889 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index 7caf3662aa0e..6b4b0b8fcebb 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -25,6 +25,7 @@ #include <vcl/edit.hxx> #include <vcl/dllapi.h> #include <vcl/timer.hxx> +#include <memory> class ImpVclMEdit; class Timer; @@ -77,12 +78,12 @@ class VCL_DLLPUBLIC VclMultiLineEdit : public Edit friend class VCLXAccessibleEdit; private: - ImpVclMEdit* pImpVclMEdit; + std::unique_ptr<ImpVclMEdit> pImpVclMEdit; OUString aSaveValue; Link<Edit&,void> aModifyHdlLink; - Timer* pUpdateDataTimer; + std::unique_ptr<Timer> pUpdateDataTimer; Link<Edit&,void> aUpdateDataHdlLink; protected: @@ -117,7 +118,7 @@ public: virtual bool IsModified() const override; virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT ) override; - virtual void DisableUpdateData() override { delete pUpdateDataTimer; pUpdateDataTimer = nullptr; } + virtual void DisableUpdateData() override { pUpdateDataTimer.reset(); } virtual void SetReadOnly( bool bReadOnly = true ) override; virtual bool IsReadOnly() const override; diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 092970d08f28..32a2b209696e 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -904,7 +904,7 @@ VclMultiLineEdit::VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ) : Edit( pParent, nWinStyle ) { SetType( WindowType::MULTILINEEDIT ); - pImpVclMEdit = new ImpVclMEdit( this, nWinStyle ); + pImpVclMEdit.reset(new ImpVclMEdit( this, nWinStyle )); ImplInitSettings( true ); pUpdateDataTimer = nullptr; @@ -919,13 +919,8 @@ VclMultiLineEdit::~VclMultiLineEdit() void VclMultiLineEdit::dispose() { - { - std::unique_ptr< ImpVclMEdit > xDelete(pImpVclMEdit); - pImpVclMEdit = nullptr; - } - delete pUpdateDataTimer; - pUpdateDataTimer = nullptr; - + pImpVclMEdit.reset(); + pUpdateDataTimer.reset(); Edit::dispose(); } @@ -1094,7 +1089,7 @@ void VclMultiLineEdit::EnableUpdateData( sal_uLong nTimeout ) { if ( !pUpdateDataTimer ) { - pUpdateDataTimer = new Timer("MultiLineEditTimer"); + pUpdateDataTimer.reset(new Timer("MultiLineEditTimer")); pUpdateDataTimer->SetInvokeHandler( LINK( this, VclMultiLineEdit, ImpUpdateDataHdl ) ); } pUpdateDataTimer->SetTimeout( nTimeout ); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
