diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-01-27 08:40:02 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-01-27 12:51:32 +0000 |
commit | 5d4adec9e0c3edca15867aac19ff6d2c0983959f (patch) | |
tree | 7f6d9a79bcea8a34d09f632a691ad672b999997f /framework | |
parent | 1371ba2bcbcce57ba5cbd7a199ae8feceb22d0d0 (diff) |
Move a UNO service creation outside a guarded area
When trying to address a deadlock issue involving NotifySingleListenerIgnoreRE
(sfx2/source/doc/sfxbasemodel.cxx), I ran into another deadlock between a
cppu_threadpool thread at
> comphelper::SolarMutex::acquire
> osl::ClearableGuard<comphelper::SolarMutex>::ClearableGuard
> SolarMutexClearableGuard::SolarMutexClearableGuard
> SfxModelGuard::SfxModelGuard
> SfxBaseModel::getIdentifier
> (anonymous namespace)::ModuleManager::implts_identify
> (anonymous namespace)::ModuleManager::identify
> (anonymous namespace)::JobExecutor::notifyEvent
> (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyJobExecution
> (anonymous namespace)::SfxGlobalEvents_Impl::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
> SfxObjectShell::SetInitialized_Impl
> SfxObjectShell::FinishedLoading
> ScDocShell::Load
> SfxObjectShell::LoadOwnFormat
> SfxObjectShell::DoLoad
> SfxBaseModel::load
> (anonymous namespace)::SfxFrameLoader_Impl::load
> framework::LoadEnv::impl_loadContent
> framework::LoadEnv::start
> framework::LoadEnv::startLoading
> framework::LoadEnv::loadComponentFromURL
> framework::Desktop::loadComponentFromURL
> gcc3::callVirtualMethod
and the main thread at
> osl::Mutex::acquire
> osl::Guard
> (anonymous namespace)::JobExecutor::trigger
> desktop::Desktop::AsyncInitFirstRun
> desktop::Desktop::LinkStubAsyncInitFirstRun
> Link<Timer*, void>::Call
> Timer::Invoke
> Scheduler::CallbackTaskScheduling
> SalTimer::CallCallback
> SvpSalInstance::CheckTimeout
> SvpSalInstance::ImplYield
> SvpSalInstance::DoYield
> ImplYield
> Application::Yield
> Application::Execute
> desktop::Desktop::Main
which this commit fixes. (I commit this independently of any commit addressing
that other 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: I2530569c6661e440126db04fa19a655d52e20094
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146242
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/jobs/jobexecutor.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 5578b877b028..65c7dc25ded4 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -247,9 +247,6 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent OUString aModuleIdentifier; ::std::vector< JobData::TJob2DocEventBinding > lJobs; - /* SAFE */ { - osl::MutexGuard g(rBHelper.rMutex); - // Optimization! // Check if the given event name exist inside configuration and reject wrong requests. // This optimization suppress using of the cfg api for getting event and job descriptions. @@ -263,6 +260,9 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent catch( const css::uno::Exception& ) {} + /* SAFE */ { + osl::MutexGuard g(rBHelper.rMutex); + // Special feature: If the events "OnNew" or "OnLoad" occurs - we generate our own event "onDocumentOpened". if ( (aEvent.EventName == "OnNew") || |