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

New commits:
commit 677b13aa5c695b44ada7a0b11d6c9b91fc38ff51
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue Apr 2 10:38:58 2024 -0400
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Tue Apr 2 23:22:56 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>
    (cherry picked from commit 89e23bb599104d3bde30878148e15cf4deb1593f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165710
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 622814248670..ceba81f9470a 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -654,7 +654,7 @@ OUString replaceOrigin(
 
 
 void BackendImpl::PackageImpl::processPackage_(
-    ::osl::ResettableMutexGuard &,
+    ::osl::ResettableMutexGuard & guard,
     bool doRegisterPackage,
     bool startup,
     ::rtl::Reference<AbortChannel> const &,
@@ -689,7 +689,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(
@@ -701,6 +704,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