diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-12 09:47:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-12 09:54:07 +0100 |
commit | 0bab9c02285ead494edbc456a96f38545823bb10 (patch) | |
tree | 86543e7d7db14858f057411e0b055a0f0b9bb8aa /sfx2 | |
parent | 25f06457382bb5c9c648d65eb102c9d91983cda0 (diff) |
use unique_ptr in SfxChildWinCtor
Change-Id: I155036f6a47c765595938ff325ede6bbe6dd5c48
Reviewed-on: https://gerrit.libreoffice.org/65000
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/dockwin.cxx | 5 |
3 files changed, 6 insertions, 7 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 2c53919f1c38..70dc1e7f3996 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -201,10 +201,10 @@ SfxChildWindow::~SfxChildWindow() } -SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, +std::unique_ptr<SfxChildWindow> SfxChildWindow::CreateChildWindow( sal_uInt16 nId, vcl::Window *pParent, SfxBindings* pBindings, SfxChildWinInfo const & rInfo) { - SfxChildWindow *pChild=nullptr; + std::unique_ptr<SfxChildWindow> pChild; SfxChildWinFactory* pFact=nullptr; SystemWindowFlags nOldMode = Application::GetSystemWindowMode(); @@ -275,7 +275,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, if (pChild && (!pChild->pWindow && !pChild->xController)) { - DELETEZ(pChild); + pChild.reset(); SAL_INFO("sfx.appl", "ChildWindow has no Window!"); } diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index b7f6eddd9777..419b2b4d6d17 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1337,7 +1337,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus ) { pCW->aInfo.bVisible = true; - SfxChildWindow *pChildWin = SfxChildWindow::CreateChildWindow( pCW->nId, pWorkWin, &GetBindings(), pCW->aInfo); + SfxChildWindow *pChildWin = SfxChildWindow::CreateChildWindow( pCW->nId, pWorkWin, &GetBindings(), pCW->aInfo).release(); if (pChildWin) { if ( bSetFocus ) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 5df504293d0e..1297ff1358e2 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -203,11 +203,10 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd , SetHideNotDelete( true ); } -SfxChildWindow* SfxDockingWrapper::CreateImpl(vcl::Window *pParent, sal_uInt16 nId, +std::unique_ptr<SfxChildWindow> SfxDockingWrapper::CreateImpl(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo) { - SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo); - return pWin; + return o3tl::make_unique<SfxDockingWrapper>(pParent, nId, pBindings, pInfo); } void SfxDockingWrapper::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChildWindowFlags nFlags) |