fpicker/source/win32/VistaFilePickerImpl.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit e5bd911b01d9437841e2ec59a233ce6a6baa4dbf
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu May 5 08:25:11 2022 +0300
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri May 6 13:23:26 2022 +0200

    tdf#146007: make sure to not hold solar mutex
    
    COM might need to forward the call to another thread (with corresponding
    apartment); if that thread happens to wait for solar mutex, COM call may
    deadlock.
    
    Change-Id: I8fcf04619cd29b678fd7ade87254b9aad2f639a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133853
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133882

diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx 
b/fpicker/source/win32/VistaFilePickerImpl.cxx
index a38e237e2511..7f631d377884 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -36,6 +36,7 @@
 #include <osl/file.hxx>
 #include <rtl/process.h>
 #include <o3tl/char16_t2wchar_t.hxx>
+#include <vcl/svapp.hxx>
 #include "WinImplHelper.hxx"
 
 #include <shlguid.h>
@@ -961,6 +962,10 @@ void 
VistaFilePickerImpl::impl_sta_ShowDialogModal(Request& rRequest)
     HRESULT hResult = E_FAIL;
     try
     {
+        // tdf#146007: Make sure we don't hold solar mutex: COM may need to 
forward
+        // the execution to the main thread, and holding solar mutex could 
deadlock
+        SolarMutexGuard g; // First acquire, to avoid releaser failure
+        SolarMutexReleaser r;
         // show dialog and wait for user decision
         hResult = iDialog->Show(m_hParentWindow ? m_hParentWindow
                                                 : choose_parent_window()); // 
parent window needed

Reply via email to