diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2018-02-08 13:04:27 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2018-02-08 23:31:44 +0100 |
commit | d09bdaaa660c40df241e6e1c0b8a3e905db85420 (patch) | |
tree | b730e74edc620fb7252ea4df7c41f1d13e8ee34f /sfx2 | |
parent | badbdb41acf69e3eba4ca7253ec0218dc1e63d0a (diff) |
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@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/statcach.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/inc/statcach.hxx | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 87197d045ea5..ea900d2f6145 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1604,6 +1604,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 |