Kaydet (Commit) d09bdaaa authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

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 a5dbe5a8
("use rtl::Reference in svl,sfx2")

Change-Id: I52da6152f0ddb0030d7354f7201e969d5a1f11cf
Reviewed-on: https://gerrit.libreoffice.org/49423Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst badbdb41
......@@ -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 );
......
......@@ -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();
}
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment