[Libreoffice-commits] core.git: sfx2/source
Maxim Monastirsky
momonasmon at gmail.com
Thu Feb 8 22:32:08 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 d09bdaaa660c40df241e6e1c0b8a3e905db85420
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>
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
More information about the Libreoffice-commits
mailing list