desktop/source/deployment/registry/configuration/dp_configuration.cxx |    8 
++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 89e23bb599104d3bde30878148e15cf4deb1593f
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue Apr 2 10:38:58 2024 -0400
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Apr 2 21:10:19 2024 +0200

    tdf#159790 eliminate deadlock on main thread
    
    A separate thread may have already acquired m_aMutex and that
    thread will then try to acquire the solar mutex. However, when
    the main thread calls this method, the main thread has already
    acquired the solar mutex.
    
    So, drop the desktop mutex before calling out.
    
    Change-Id: Ic87063266ac5101b866df9f24067a403e1417745
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165682
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 3bfac940bce6..9ef3cc969432 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -653,7 +653,7 @@ OUString replaceOrigin(
 
 
 void BackendImpl::PackageImpl::processPackage_(
-    ::osl::ResettableMutexGuard &,
+    ::osl::ResettableMutexGuard & guard,
     bool doRegisterPackage,
     bool startup,
     ::rtl::Reference<AbortChannel> const &,
@@ -688,7 +688,10 @@ void BackendImpl::PackageImpl::processPackage_(
             if ((that->m_eContext != Context::Bundled && !startup)
                  || comphelper::LibreOfficeKit::isActive())
             {
-                if (m_isSchema)
+                bool bIsSchema = m_isSchema;
+                // tdf#159790 prevent lock-ordering deadlock, the code below 
might acquire the solar mutex
+                guard.clear();
+                if (bIsSchema)
                 {
                     css::configuration::Update::get(
                         that->m_xComponentContext)->insertExtensionXcsFile(
@@ -700,6 +703,7 @@ void BackendImpl::PackageImpl::processPackage_(
                         that->m_xComponentContext)->insertExtensionXcuFile(
                             that->m_eContext == Context::Shared, 
expandUnoRcUrl(url));
                 }
+                guard.reset();
             }
             that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv );
             data.iniEntry = dp_misc::makeRcTerm(url);

Reply via email to