diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-11 09:48:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-13 06:49:23 +0000 |
commit | e8b49f09074fe184374bee5062715357427ae044 (patch) | |
tree | b9cf1f5e3d7ab8b98345a512b6ddb0da42fe2919 /vcl/source/window | |
parent | 5e0e27e758e6f7fa325f36e6e51540e10bab0fdc (diff) |
new loplugin: useuniqueptr: vcl
Change-Id: Idcbc8655108ff57c06c33bbcabd652387bf3c4ec
Reviewed-on: https://gerrit.libreoffice.org/32948
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/commandevent.cxx | 17 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 1 | ||||
-rw-r--r-- | vcl/source/window/dockwin.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/syswin.cxx | 18 | ||||
-rw-r--r-- | vcl/source/window/tabpage.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 4 |
7 files changed, 20 insertions, 30 deletions
diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx index 6a1f140287fd..bb00c312c86b 100644 --- a/vcl/source/window/commandevent.cxx +++ b/vcl/source/window/commandevent.cxx @@ -28,12 +28,8 @@ CommandExtTextInputData::CommandExtTextInputData( const OUString& rText, { if ( pTextAttr && !maText.isEmpty() ) { - mpTextAttr = new ExtTextInputAttr[maText.getLength()]; - memcpy( mpTextAttr, pTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) ); - } - else - { - mpTextAttr = nullptr; + mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] ); + memcpy( mpTextAttr.get(), pTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) ); } mnCursorPos = nCursorPos; @@ -46,12 +42,8 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& { if ( rData.mpTextAttr && !maText.isEmpty() ) { - mpTextAttr = new ExtTextInputAttr[maText.getLength()]; - memcpy( mpTextAttr, rData.mpTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) ); - } - else - { - mpTextAttr = nullptr; + mpTextAttr.reset( new ExtTextInputAttr[maText.getLength()] ); + memcpy( mpTextAttr.get(), rData.mpTextAttr.get(), maText.getLength()*sizeof(ExtTextInputAttr) ); } mnCursorPos = rData.mnCursorPos; @@ -61,7 +53,6 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData& CommandExtTextInputData::~CommandExtTextInputData() { - delete [] mpTextAttr; } CommandInputContextData::CommandInputContextData( LanguageType eLang ) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1b789020c6ed..4e0fd974d161 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1202,7 +1202,6 @@ VclBuilderContainer::VclBuilderContainer() VclBuilderContainer::~VclBuilderContainer() { - delete m_pUIBuilder; } ModelessDialog::ModelessDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, InitFlag eFlag) diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index a36b73577ba4..4c854c00cefb 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -374,7 +374,7 @@ void DockingWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStr { mbIsDefferedInit = true; mpDialogParent = pParent; //should be unset in doDeferredInit - m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame); + m_pUIBuilder.reset( new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame) ); } DockingWindow::DockingWindow(vcl::Window* pParent, const OString& rID, diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index cdee3a4bb9d8..d0df38d0ed7f 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -569,9 +569,9 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const std::shared_ptr<PrinterC : ModalDialog(i_pParent, "PrintDialog", "vcl/ui/printdialog.ui") , mpCustomOptionsUIBuilder(nullptr) , maPController( i_rController ) - , maNUpPage(m_pUIBuilder) - , maJobPage(m_pUIBuilder) - , maOptionsPage(m_pUIBuilder) + , maNUpPage(m_pUIBuilder.get()) + , maJobPage(m_pUIBuilder.get()) + , maOptionsPage(m_pUIBuilder.get()) , maNoPageStr( VclResId( SV_PRINT_NOPAGES ).toString() ) , mnCurPage( 0 ) , mnCachedPages( 0 ) diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 21cdeb38ec54..93ebb94f6347 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -51,7 +51,8 @@ public: ImplData(); ~ImplData(); - TaskPaneList* mpTaskPaneList; + std::unique_ptr<TaskPaneList> + mpTaskPaneList; Size maMaxOutSize; OUString maRepresentedURL; Link<SystemWindow&,void> maCloseHdl; @@ -65,7 +66,6 @@ SystemWindow::ImplData::ImplData() SystemWindow::ImplData::~ImplData() { - delete mpTaskPaneList; } SystemWindow::SystemWindow(WindowType nType) @@ -94,7 +94,7 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri { mbIsDefferedInit = true; mpDialogParent = pParent; //should be unset in doDeferredInit - m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame); + m_pUIBuilder.reset( new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame) ); } SystemWindow::~SystemWindow() @@ -219,12 +219,12 @@ bool SystemWindow::PreNotify( NotifyEvent& rNEvt ) } else { - TaskPaneList *pTList = mpImplData->mpTaskPaneList; + TaskPaneList *pTList = mpImplData->mpTaskPaneList.get(); if( !pTList && ( GetType() == WINDOW_FLOATINGWINDOW ) ) { vcl::Window* pWin = ImplGetFrameWindow()->ImplGetWindow(); if( pWin && pWin->IsSystemWindow() ) - pTList = static_cast<SystemWindow*>(pWin)->mpImplData->mpTaskPaneList; + pTList = static_cast<SystemWindow*>(pWin)->mpImplData->mpTaskPaneList.get(); } if( !pTList ) { @@ -237,7 +237,7 @@ bool SystemWindow::PreNotify( NotifyEvent& rNEvt ) if( pWin && pWin->IsSystemWindow() ) pSysWin = static_cast<SystemWindow*>(pWin); } - pTList = pSysWin->mpImplData->mpTaskPaneList; + pTList = pSysWin->mpImplData->mpTaskPaneList.get(); } if( pTList && pTList->HandleKeyEvent( *rNEvt.GetKeyEvent() ) ) return true; @@ -251,10 +251,10 @@ TaskPaneList* SystemWindow::GetTaskPaneList() if( !mpImplData ) return nullptr; if( mpImplData->mpTaskPaneList ) - return mpImplData->mpTaskPaneList ; + return mpImplData->mpTaskPaneList.get(); else { - mpImplData->mpTaskPaneList = new TaskPaneList(); + mpImplData->mpTaskPaneList.reset( new TaskPaneList ); MenuBar* pMBar = mpMenuBar; if ( !pMBar && ( GetType() == WINDOW_FLOATINGWINDOW ) ) { @@ -264,7 +264,7 @@ TaskPaneList* SystemWindow::GetTaskPaneList() } if( pMBar ) mpImplData->mpTaskPaneList->AddWindow( pMBar->ImplGetWindow() ); - return mpImplData->mpTaskPaneList; + return mpImplData->mpTaskPaneList.get(); } } diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 0576f3af6229..cda47e0ad401 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -81,7 +81,7 @@ TabPage::TabPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXM , IContext() { ImplInit(pParent, 0); - m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID); + m_pUIBuilder.reset( new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID) ); set_hexpand(true); set_vexpand(true); set_expand(true); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index b1238d2a0c86..49ccf4893c96 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -93,7 +93,8 @@ typedef ::std::vector< VclPtr<ToolBox> > ImplTBList; class ImplTBDragMgr { private: - ImplTBList* mpBoxList; + std::unique_ptr<ImplTBList> + mpBoxList; VclPtr<ToolBox> mpDragBox; Point maMouseOff; Rectangle maRect; @@ -1144,7 +1145,6 @@ ImplTBDragMgr::ImplTBDragMgr() ImplTBDragMgr::~ImplTBDragMgr() { - delete mpBoxList; } ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect ) |