include/sfx2/childwin.hxx | 9 ++++----- sfx2/source/appl/childwin.cxx | 4 ++-- sw/source/uibase/inc/navipi.hxx | 2 +- sw/source/uibase/utlui/navipi.cxx | 5 ++--- 4 files changed, 9 insertions(+), 11 deletions(-)
New commits: commit 2b7e93142916aaa5bf529ed7abefcf1829278510 Author: Noel Grandin <[email protected]> AuthorDate: Wed Dec 12 08:49:11 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Dec 12 09:57:55 2018 +0100 use unique_ptr in SfxChildWinContextCtor Change-Id: I5ad26f30704708aac42f2c48fa38382c38f98b2a Reviewed-on: https://gerrit.libreoffice.org/64998 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index 03f7f20292b2..84ac2b31b12e 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -88,7 +88,7 @@ typedef std::unique_ptr<SfxChildWindow> (*SfxChildWinCtor)( vcl::Window *pParent SfxChildWinInfo *pInfo); // ChildWindowsContexts factory methods -typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( vcl::Window *pParentWindow, +typedef std::unique_ptr<SfxChildWindowContext> (*SfxChildWinContextCtor)( vcl::Window *pParentWindow, SfxBindings *pBindings, SfxChildWinInfo *pInfo); struct SfxChildWinContextFactory @@ -218,7 +218,7 @@ public: //! The Macro of the future ... #define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ - static SfxChildWindowContext* CreateImpl(vcl::Window *pParent, \ + static std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=nullptr); \ @@ -227,11 +227,10 @@ public: // factory. As long as Id is set to 0 and patched in // SfxChildWindow::CreateContext #define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ - SfxChildWindowContext* Class::CreateImpl( vcl::Window *pParent, \ + std::unique_ptr<SfxChildWindowContext> Class::CreateImpl( vcl::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ - SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\ - return pContext; \ + return o3tl::make_unique<Class>(pParent,0,pBindings,pInfo);\ } \ void Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod) \ { \ diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 70dc1e7f3996..7966c3de1c95 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -433,7 +433,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBindings ) { - SfxChildWindowContext *pCon = nullptr; + std::unique_ptr<SfxChildWindowContext> pCon; SfxChildWinFactory* pFact=nullptr; SfxApplication *pApp = SfxGetpApp(); SfxDispatcher *pDisp = rBindings.GetDispatcher_Impl(); @@ -508,7 +508,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding return; } - pContext.reset(pCon); + pContext = std::move(pCon); pContext->GetWindow()->SetSizePixel( pWindow->GetOutputSizePixel() ); pContext->GetWindow()->Show(); } diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index f5c6659da7b8..17b86aada357 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -170,7 +170,7 @@ public: SfxBindings* ); //! soon obsolete ! - static SfxChildWindowContext* CreateImpl(vcl::Window *pParent, + static std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent, SfxBindings *pBindings, SfxChildWinInfo* pInfo ); static void RegisterChildWindowContext(SfxModule *pMod); }; diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 4015bd1aa922..cc36b1431f39 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -63,13 +63,12 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; //! soon obsolete ! -SfxChildWindowContext* SwNavigationChild::CreateImpl( vcl::Window *pParent, +std::unique_ptr<SfxChildWindowContext> SwNavigationChild::CreateImpl( vcl::Window *pParent, SfxBindings *pBindings, SfxChildWinInfo* /*pInfo*/ ) { - SfxChildWindowContext *pContext = new SwNavigationChild(pParent, + return o3tl::make_unique<SwNavigationChild>(pParent, /* cast is safe here! */static_cast< sal_uInt16 >(SwView::GetInterfaceId()), pBindings); - return pContext; } void SwNavigationChild::RegisterChildWindowContext(SfxModule* pMod) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
