vcl/source/app/svdata.cxx |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

New commits:
commit e8e1c9cbd58c123cf37681ccff1c417e537a9272
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Mar 14 12:53:00 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 14 14:03:49 2025 +0100

    fix deadlock in SystemDependentDataBuffer::flushAll (tdf#131595 related)
    
    seen while testing my other patches for this bug
    
    Change-Id: I1c14bdfe5ec60915885dd062a7bb81a284459da9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182911
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 2ff5e69abf48..414de68e7f6c 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -177,15 +177,21 @@ namespace
 
         void flushAll() override
         {
-            std::unique_lock aGuard(m_aMutex);
-
-            if(maTimer)
+            EntryMap aTmpEntries;
             {
-                maTimer->Stop();
-                maTimer.reset();
-            }
+                std::unique_lock aGuard(m_aMutex);
 
-            maEntries.clear();
+                if(maTimer)
+                {
+                    maTimer->Stop();
+                    maTimer.reset();
+                }
+
+                aTmpEntries = std::move(maEntries);
+            }
+            // we need to destruct the entries outside the lock, because
+            // we might call back into endUsage() and that will take the lock 
again and deadlock.
+            aTmpEntries.clear();
         }
     };
 

Reply via email to