basic/source/classes/sbxmod.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit e3e259d551c0c8b7c106191f2c258e5929db1b29
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Sun Jan 29 11:51:10 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Sun Jan 29 12:09:07 2023 +0000

    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 <sberg...@redhat.com>

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();

Reply via email to