chart2/source/controller/inc/AccessibleBase.hxx |    4 +---
 connectivity/Library_hsqldb.mk                  |    1 +
 connectivity/source/drivers/hsqldb/HDriver.cxx  |    8 ++++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit e7d0b0d6b929b93a4972af43a979a53a90c5ae1d
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Mar 28 09:16:06 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Mar 28 10:36:40 2025 +0100

    fix CppunitTest_dbaccess_SingleSelectQueryComposer_test deadlock (2)
    
    similar to
        commit c02c75ba1e748ee72f299464fc6cf34f9ddc9298
        Author: Noel Grandin <[email protected]>
        Date:   Thu Mar 27 14:28:02 2025 +0200
        fix CppunitTest_dbaccess_SingleSelectQueryComposer_test deadlock
    
    deadlocking threads are
    
     in privateSnippetExecutor
     in connectivity::hsqldb::ODriverDelegator::shutdownConnection
     in connectivity::hsqldb::ODriverDelegator::disposing
     in privateSnippetExecutor
     in dbaccess::OConnection::disposing
     in dbaccess::OSharedConnection::close
     in SingleSelectQueryComposerTest::tearDown
    
    and
    
    Thread 42 (Thread 0x7f7d6e672700 (LWP 3544697) "DocumentEventNo"):
     in comphelper::SolarMutex::acquire
     in dbaccess::ModelMethodGuard::ModelMethodGuard
     in dbaccess::DocumentGuard::DocumentGuard
     in dbaccess::ODatabaseDocument::getCurrentController
    in non-virtual thunk to
    dbaccess::ODatabaseDocument::getCurrentController
     in tdoc_ucp::OfficeDocumentsManager::isWithoutOrInTopLevelFrame
     in tdoc_ucp::OfficeDocumentsManager::isOfficeDocument
     in tdoc_ucp::OfficeDocumentsManager::documentEventOccured
     in dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow
     in dbaccess::DocumentEventNotifier_Impl::processEvent
     in comphelper::AsyncEventNotifierBase::execute()
     in comphelper::AsyncEventNotifierAutoJoin::run()
     in threadFunc(void*) (param=0x36a7450)
    
    Change-Id: Ifb8e37a05ce62ca37132e8391980de821bb97ee8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183428
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/connectivity/Library_hsqldb.mk b/connectivity/Library_hsqldb.mk
index 40764b9237d8..9b950eb6e7c7 100644
--- a/connectivity/Library_hsqldb.mk
+++ b/connectivity/Library_hsqldb.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,hsqldb,\
        salhelper \
        tl \
        utl \
+       vcl \
        i18nlangtag \
 ))
 
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx 
b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 91cab732fcee..f43584d1f169 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -52,6 +52,7 @@
 #include <i18nlangtag/languagetag.hxx>
 #include <comphelper/diagnose_ex.hxx>
 #include <o3tl/string_view.hxx>
+#include <vcl/svapp.hxx>
 
 #include <memory>
 
@@ -534,7 +535,14 @@ namespace connectivity
                     if ( xRow.is() && xRes->next() )
                         bLastOne = xRow->getInt(1) == 1;
                     if ( bLastOne )
+                    {
+                        // during shutdown, we are running on the main thread, 
and if we call this,
+                        // it might trigger 
dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow
+                        // which is running on a different thread, and that 
will call other code that tries
+                        // to take the solar mutex.
+                        SolarMutexReleaser aReleaser;
                         xStmt->execute(u"SHUTDOWN"_ustr);
+                    }
                 }
             }
         }
commit eadd7bfecd0a3570a353a142250136636222775b
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Mar 27 15:06:00 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Mar 28 10:36:30 2025 +0100

    remove volatile from m_bStateSetInitialized
    
    because volatile does not mean thread-safe in C++
    
    And update comment, because there is no double-checked locking going on
    here.
    
    Change-Id: I7fe8622d4e193387664edf659a408575f2f8d0f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183397
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/chart2/source/controller/inc/AccessibleBase.hxx 
b/chart2/source/controller/inc/AccessibleBase.hxx
index 77bb2526c961..926611bfb8ec 100644
--- a/chart2/source/controller/inc/AccessibleBase.hxx
+++ b/chart2/source/controller/inc/AccessibleBase.hxx
@@ -305,10 +305,8 @@ private:
         state is checked.
 
         This variable is monitored by the solar mutex!
-
-        Note: declared volatile to enable double-check-locking
      */
-    volatile bool          m_bStateSetInitialized;
+    bool          m_bStateSetInitialized;
 };
 
 }  // namespace chart

Reply via email to