[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sfx2/source

Maxim Monastirsky momonasmon at gmail.com
Wed Feb 21 20:35:19 UTC 2018


 sfx2/source/control/bindings.cxx |    1 +
 sfx2/source/control/statcach.cxx |    7 ++++++-
 sfx2/source/inc/statcach.hxx     |    2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit f8a7d0426729b1982f1a03b933bc148acab12bd9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Thu Feb 8 13:04:27 2018 +0200

    tdf#115430 BindDispatch_Impl needs a disposal method
    
    The dtor will never be called otherwise, because the
    dispatcher is holding a reference to us, so
    removeStatusListener is needed first.
    
    Regression of a5dbe5a8a9e98f2d79f2c535182fc557b561ed0f
    ("use rtl::Reference in svl,sfx2")
    
    Change-Id: I52da6152f0ddb0030d7354f7201e969d5a1f11cf
    Reviewed-on: https://gerrit.libreoffice.org/49423
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
    (cherry picked from commit d09bdaaa660c40df241e6e1c0b8a3e905db85420)
    Reviewed-on: https://gerrit.libreoffice.org/49463
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 1356c20fc231..058b496c4a1b 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1607,6 +1607,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, std::unique_ptr<SfxPoolI
                 }
 
                 xDisp->removeStatusListener( xBind.get(), aURL );
+                xBind->Release();
                 xBind.clear();
                 if ( bDeleteCache )
                     DELETEZ( pCache );
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index 1ec54f2fd1c3..0d6d5b6b08fa 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -145,13 +145,14 @@ void SAL_CALL  BindDispatch_Impl::statusChanged( const css::frame::FeatureStateE
     }
 }
 
-BindDispatch_Impl::~BindDispatch_Impl()
+void BindDispatch_Impl::Release()
 {
     if ( xDisp.is() )
     {
         xDisp->removeStatusListener( static_cast<css::frame::XStatusListener*>(this), aURL );
         xDisp.clear();
     }
+    pCache = nullptr;
 }
 
 
@@ -197,6 +198,8 @@ SfxStateCache::~SfxStateCache()
     DBG_ASSERT( pController == nullptr && pInternalController == nullptr, "there are still Controllers registered" );
     if ( !IsInvalidItem(pLastItem) )
         delete pLastItem;
+    if ( mxDispatch.is() )
+        mxDispatch->Release();
 }
 
 
@@ -208,6 +211,8 @@ void SfxStateCache::Invalidate( bool bWithMsg )
     {
         bSlotDirty = true;
         aSlotServ.SetSlot( nullptr );
+        if ( mxDispatch.is() )
+            mxDispatch->Release();
         mxDispatch.clear();
     }
 }
diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx
index ef09b5dd51c4..58ddc1766889 100644
--- a/sfx2/source/inc/statcach.hxx
+++ b/sfx2/source/inc/statcach.hxx
@@ -46,13 +46,13 @@ public:
                                 const css::uno::Reference< css::frame::XDispatch > & rDisp,
                                 const css::util::URL& rURL,
                                 SfxStateCache* pStateCache, const SfxSlot* pSlot );
-                            ~BindDispatch_Impl() override;
 
     virtual void SAL_CALL   statusChanged( const css::frame::FeatureStateEvent& Event ) override;
     virtual void SAL_CALL   disposing( const css::lang::EventObject& Source ) override;
 
     const css::frame::FeatureStateEvent& GetStatus() const { return aStatus;}
     sal_Int16               Dispatch( const css::uno::Sequence < css::beans::PropertyValue >& aProps, bool bForceSynchron );
+    void                    Release();
 };
 
 class SfxStateCache


More information about the Libreoffice-commits mailing list