svx/source/form/fmscriptingenv.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 2be7689549ca126de2cb404e79f60c3f503a51fd
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Oct 2 19:50:33 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 3 16:56:27 2024 +0200

    cid#1606754 Thread deadlock
    
    Change-Id: I51985e5ac573aa42c011730b73848ab55a4b2130
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174410
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svx/source/form/fmscriptingenv.cxx 
b/svx/source/form/fmscriptingenv.cxx
index cf567083b6a0..8012319f5e33 100644
--- a/svx/source/form/fmscriptingenv.cxx
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -917,10 +917,15 @@ namespace svxform
 
     void FormScriptingEnvironment::dispose()
     {
-        std::unique_lock aGuard( m_aMutex );
-        m_bDisposed = true;
-        m_pScriptListener->dispose();
-        m_pScriptListener.clear();
+        rtl::Reference<FormScriptListener> xListener;
+        {
+            std::unique_lock aGuard( m_aMutex );
+            if (m_bDisposed)
+                return;
+            m_bDisposed = true;
+            xListener = std::move(m_pScriptListener);
+        }
+        xListener->dispose();
     }
 
 }

Reply via email to