include/tools/debug.hxx      |   13 ++++++++++---
 tools/source/debug/debug.cxx |    4 ++--
 vcl/source/app/dbggui.cxx    |    8 ++++++--
 3 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit f925413eda11de362c22331f184555ca0e1ba884
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Wed Feb 19 10:06:16 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jul 23 21:49:58 2025 +0200

    Introduce DBG_TESTNOTSOLARMUTEX, to complement DBG_TESTSOLARMUTEX
    
    ...and use it in one place for the experimental Emscripten Qt6
    JSPI/non-PROXY_TO_PTHREAD mode (where I have a hunch that some of the 
deadlocks
    I experience in that experimental mode are due to a mis-locked SolarMutex)
    
    Change-Id: Ifb335202569b7d2beecd7a502064ebcfdaaddbab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181872
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    (cherry picked from commit 71e781cbe597a6173e9956e14f82bfa661df9dde)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188212
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx
index c72da4d06887..e85a6fb3e0ec 100644
--- a/include/tools/debug.hxx
+++ b/include/tools/debug.hxx
@@ -34,10 +34,10 @@
     standard assert.
 */
 
-typedef void (*DbgTestSolarMutexProc)();
+typedef void (*DbgTestSolarMutexProc)(bool);
 
 TOOLS_DLLPUBLIC void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam );
-TOOLS_DLLPUBLIC void DbgTestSolarMutex();
+TOOLS_DLLPUBLIC void DbgTestSolarMutex(bool owned);
 
 #ifndef NDEBUG
 // we want the solar mutex checking to be enabled in the assert-enabled builds 
that the QA people use
@@ -45,12 +45,19 @@ TOOLS_DLLPUBLIC void DbgTestSolarMutex();
 #define DBG_TESTSOLARMUTEX()   \
 do                             \
 {                              \
-    DbgTestSolarMutex();       \
+    DbgTestSolarMutex(true);   \
+} while(false)
+
+#define DBG_TESTNOTSOLARMUTEX() \
+do                             \
+{                              \
+    DbgTestSolarMutex(false);  \
 } while(false)
 
 #else
 
 #define DBG_TESTSOLARMUTEX() ((void)0)
+#define DBG_TESTNOTSOLARMUTEX() ((void)0)
 
 #endif
 
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index 197ba2450493..ee6a379d0c5e 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -44,14 +44,14 @@ void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam )
         aDebugData.bTestSolarMutexWasSet = true;
 }
 
-void DbgTestSolarMutex()
+void DbgTestSolarMutex(bool owned)
 {
     // don't warn if it was set at least once, because then we're probably 
just post-DeInitVCL()
     SAL_WARN_IF(
         !aDebugData.bTestSolarMutexWasSet && aDebugData.pDbgTestSolarMutex == 
nullptr, "tools.debug",
         "no DbgTestSolarMutex function set");
     if ( aDebugData.pDbgTestSolarMutex )
-        aDebugData.pDbgTestSolarMutex();
+        aDebugData.pDbgTestSolarMutex(owned);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index cfeeeaf5d9ae..ee1a0b72dbd9 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -30,9 +30,13 @@
 
 using namespace ::com::sun::star;
 
-static void ImplDbgTestSolarMutex()
+static void ImplDbgTestSolarMutex(bool owned)
 {
-    assert(ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && 
"SolarMutex not owned!");
+    if (owned) {
+        assert(ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() 
&& "SolarMutex not owned!");
+    } else {
+        assert(!ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() 
&& "SolarMutex owned!");
+    }
 }
 
 void DbgGUIInitSolarMutexCheck()

Reply via email to