summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-05-05 08:25:11 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-05-05 11:57:56 +0200
commitb8bb44161aeb6e00526a38343b63e678ce7d4a1a (patch)
treed1600813044938609545986412e545d0cb1b6ef5 /fpicker
parent7c5d3d74ee7c1f5bb87e46c5ff532451a94cf115 (diff)
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/VistaFilePickerImpl.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx
index 81732ce5cc97..741fdadb621a 100644
--- a/fpicker/source/win32/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/VistaFilePickerImpl.cxx
@@ -37,6 +37,7 @@
#include <rtl/process.h>
#include <o3tl/char16_t2wchar_t.hxx>
#include <o3tl/string_view.hxx>
+#include <vcl/svapp.hxx>
#include "WinImplHelper.hxx"
#include <shlguid.h>
@@ -962,6 +963,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