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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 13 06:17:42 UTC 2020


 include/sfx2/bindings.hxx        |    2 +-
 sfx2/source/appl/workwin.cxx     |    2 +-
 sfx2/source/control/bindings.cxx |   15 +++++++--------
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 8436c023383e46d50c3d31736ea02896f7282781
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 12 14:20:50 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 13 08:16:50 2020 +0200

    use unique_ptr in SfxBindings_Impl
    
    Change-Id: I8377fc5e8d79456aaa5d827f62e3d9c74ca8e52a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100623
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
index 28b4d5248517..3eb756ebb18d 100644
--- a/include/sfx2/bindings.hxx
+++ b/include/sfx2/bindings.hxx
@@ -170,7 +170,7 @@ public:
     SAL_DLLPRIVATE void RegisterInternal_Impl( SfxControllerItem& rBinding );
     SAL_DLLPRIVATE void Register_Impl( SfxControllerItem& rBinding, bool );
     SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
-    SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
+    SAL_DLLPRIVATE void SetWorkWindow_Impl( std::unique_ptr<SfxWorkWindow> );
     SAL_DLLPRIVATE SfxBindings* GetSubBindings_Impl() const;
     SAL_DLLPRIVATE void SetRecorder_Impl( css::uno::Reference< css::frame::XDispatchRecorder > const & );
     SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl();
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index ce08cdf3875e..e82c0a49d98a 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -476,7 +476,7 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMast
 {
     DBG_ASSERT (pBindings, "No Bindings!");
 
-    pBindings->SetWorkWindow_Impl( this );
+    pBindings->SetWorkWindow_Impl( std::unique_ptr<SfxWorkWindow>(this) );
 
     // For the ObjectBars an integral place in the Childlist is reserved,
     // so that they always come in a defined order.
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index ce4d3a4230d4..d648fdf87537 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -103,7 +103,7 @@ class SfxBindings_Impl
 public:
     css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
     css::uno::Reference< css::frame::XDispatchProvider >  xProv;
-    SfxWorkWindow*          pWorkWin;
+    std::unique_ptr<SfxWorkWindow> mxWorkWin;
     SfxBindings*            pSubBindings;
     std::vector<std::unique_ptr<SfxStateCache>> pCaches; // One cache for each binding
     std::size_t             nCachedFunc1;   // index for the last one called
@@ -141,7 +141,6 @@ SfxBindings::SfxBindings()
     pImpl->bInNextJob = false;
     pImpl->bInUpdate = false;
     pImpl->pSubBindings = nullptr;
-    pImpl->pWorkWin = nullptr;
     pImpl->nOwnRegLevel = nRegLevel;
 
     // all caches are valid (no pending invalidate-job)
@@ -177,7 +176,7 @@ SfxBindings::~SfxBindings()
     // Delete Caches
     pImpl->pCaches.clear();
 
-    DELETEZ( pImpl->pWorkWin );
+    pImpl->mxWorkWin.reset();
 }
 
 
@@ -232,8 +231,8 @@ void SfxBindings::HidePopups( bool bHide )
 {
     // Hide SfxChildWindows
     DBG_ASSERT( pDispatcher, "HidePopups not allowed without dispatcher" );
-    if ( pImpl->pWorkWin )
-        pImpl->pWorkWin->HidePopups_Impl( bHide );
+    if ( pImpl->mxWorkWin )
+        pImpl->mxWorkWin->HidePopups_Impl( bHide );
 }
 
 void SfxBindings::Update_Impl(SfxStateCache& rCache /*The up to date SfxStatusCache*/)
@@ -1666,14 +1665,14 @@ SfxBindings* SfxBindings::GetSubBindings_Impl() const
     return pImpl->pSubBindings;
 }
 
-void SfxBindings::SetWorkWindow_Impl( SfxWorkWindow* pWork )
+void SfxBindings::SetWorkWindow_Impl( std::unique_ptr<SfxWorkWindow> xWork )
 {
-    pImpl->pWorkWin = pWork;
+    pImpl->mxWorkWin = std::move(xWork);
 }
 
 SfxWorkWindow* SfxBindings::GetWorkWindow_Impl() const
 {
-    return pImpl->pWorkWin;
+    return pImpl->mxWorkWin.get();
 }
 
 bool SfxBindings::IsInUpdate() const


More information about the Libreoffice-commits mailing list