[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 29 06:22:02 UTC 2018


 include/sfx2/childwin.hxx     |    4 ++--
 sfx2/source/appl/childwin.cxx |    6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 177f92a90aa6cc73064ae52bba58c03c7bf34699
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jan 23 17:09:11 2018 +0200

    loplugin:useuniqueptr in SfxChildWindow
    
    Change-Id: I6c9db4cd4f46790295f37c620e2efea4f61870bf
    Reviewed-on: https://gerrit.libreoffice.org/48741
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index f68fa9fbf740..3059d38a5cbb 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -148,7 +148,7 @@ class SFX2_DLLPUBLIC SfxChildWindow
     VclPtr<vcl::Window>        pWindow;         // actual contents
     SfxChildAlignment          eChildAlignment; // Current css::drawing::Alignment
     std::unique_ptr< SfxChildWindow_Impl>       pImpl;            // Implementation data
-    SfxChildWindowContext*     pContext;        // With context-sensitive ChildWindows:
+    std::unique_ptr<SfxChildWindowContext>      pContext;        // With context-sensitive ChildWindows:
                                                  // Another window in pWindow
     SAL_DLLPRIVATE void ClearWorkwin();
 
@@ -206,7 +206,7 @@ public:
 
     SAL_DLLPRIVATE SfxChildWindowContext*
                         GetContext_Impl() const
-                        { return pContext; }
+                        { return pContext.get(); }
     SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* );
 };
 
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 9257197af101..aec56687d3d7 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -193,8 +193,7 @@ void SfxChildWindow::ClearWorkwin()
 
 SfxChildWindow::~SfxChildWindow()
 {
-    delete pContext;
-    pContext = nullptr;
+    pContext.reset();
     ClearWorkwin();
     pWindow.disposeAndClear();
 }
@@ -495,8 +494,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding
         return;
     }
 
-    delete pContext;
-    pContext = pCon;
+    pContext.reset(pCon);
     pContext->GetWindow()->SetSizePixel( pWindow->GetOutputSizePixel() );
     pContext->GetWindow()->Show();
 }


More information about the Libreoffice-commits mailing list