summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2018-02-08 13:04:27 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-02-21 21:34:57 +0100
commitf8a7d0426729b1982f1a03b933bc148acab12bd9 (patch)
treec94dbabf30f08012338ae2428176d7c2bac512a3 /sfx2
parentfcbcbe607ba3c693c79b1e1c390fab3b4643e3d9 (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> (cherry picked from commit d09bdaaa660c40df241e6e1c0b8a3e905db85420) Reviewed-on: https://gerrit.libreoffice.org/49463 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/bindings.cxx1
-rw-r--r--sfx2/source/control/statcach.cxx7
-rw-r--r--sfx2/source/inc/statcach.hxx2
3 files changed, 8 insertions, 2 deletions
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