summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-01-29 11:51:10 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-01-29 12:09:07 +0000
commite3e259d551c0c8b7c106191f2c258e5929db1b29 (patch)
tree19e4c38096857ec6e717384bc21dcf6dbfcd0a21 /basic
parent32f76ba4dc73586fa5c8237a71eddd2460d0fbe8 (diff)
UNO fn FormObjEventListenerImpl::documentEventOccured must lock SolarMutex
When trying to address a deadlock issue involving NotifySingleListenerIgnoreRE (sfx2/source/doc/sfxbasemodel.cxx), I hit the DBG_TESTSOLARMUTEX at > DbgTestSolarMutex > SfxBroadcaster::RemoveListener > SfxListener::EndListening > CheckParentsOnDelete > SbxObject::~SbxObject > SbUnoObject::~SbUnoObject > SvRefBase::ReleaseRef > tools::SvRef<SbxObject>::operator= > SbUserFormModule::ResetApiObj > FormObjEventListenerImpl::documentEventOccured > (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator > comphelper::OInterfaceContainerHelper2::forEach<com::sun::star::document::XDocumentEventListener, (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>> > SfxBaseModel::postEvent_Impl > SfxBaseModel::Notify > ScModelObj::Notify > SfxBroadcaster::Broadcast > SfxApplication::NotifyEvent > SfxBaseController::dispose > (anonymous namespace)::XFrameImpl::setComponent > (anonymous namespace)::XFrameImpl::close > SfxFrame::DoClose > SfxViewFrame::Notify > SfxBroadcaster::Broadcast > (anonymous namespace)::SfxModelListener_Impl::notifyClosing > SfxBaseModel::close > SfxBaseModel::dispose > UnoApiTest::load > UnoApiTest::loadFromURL > VBAMacroTest::testVba during CppunitTest_sc_vba_macro_test, which this commit fixes. (I commit this independently of any commit addressing that deadlock, as that involves some SolarMutexReleaser hackery and might eventually get reverted, while this change here looks correct and worthwhile even on its own.) Change-Id: I4217098c33114653cd69f4bef61c9f8089ce8b24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146302 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbxmod.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 60bdc9171b48..00bfac58dd71 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2375,6 +2375,7 @@ public:
virtual void SAL_CALL documentEventOccured( const document::DocumentEvent& rEvent ) override
{
// early disposing on document event "OnUnload", to be sure Basic still exists when calling VBA "UserForm_Terminate"
+ SolarMutexGuard g;
if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) )
{
removeListener();