summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-03-30 11:19:55 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2020-03-30 14:17:36 +0200
commit1d8529c67692b119924bc5760372daa64fa4cb4a (patch)
treedfcaaf7dce8ca3185696ce3c39e15e8a9af466d2 /desktop
parentc664523d7b4523e9bb73b1e81e4c3faba5b47ee0 (diff)
lok: Avoid deadlock for password-protected doc with gtktiledviewer
Since commit 629bc69708a280b79f07b58adcda8593e22cf422 ("LOK: hold the solar mutex consistently for document method calls.", 2016-10-19), the SolarMutex needs to be acquired in 'lo_setDocumentPassword'. This caused a deadlock for gtktiledviewer when trying to open a password-protected file, since the callback handler runs in a different thread there. Temporarily release the SolarMutex in LOKInteractionHandler::handlePasswordRequest to prevent that and make opening password-protected files with gtktiledviewer work again. Change-Id: I3ec8067c2b22aff5867eb0d526d399a18947fd48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91350 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/lokinteractionhandler.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
index f749bd4397c2..3dfd602b261a 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -42,6 +42,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <sfx2/lokhelper.hxx>
#include <sfx2/viewsh.hxx>
+#include <vcl/svapp.hxx>
using namespace com::sun::star;
@@ -275,6 +276,9 @@ bool LOKInteractionHandler::handlePasswordRequest(const uno::Sequence<uno::Refer
m_pLOKit->hasOptionalFeature(bIsRequestPasswordToModify ? LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY
: LOK_FEATURE_DOCUMENT_PASSWORD))
{
+ // release SolarMutex, so the callback handler, which may run in another thread,
+ // can acquire it in 'lo_setDocumentPassword'
+ SolarMutexReleaser aReleaser;
m_pLOKit->mpCallback(bIsRequestPasswordToModify ? LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY
: LOK_CALLBACK_DOCUMENT_PASSWORD,
sUrl.getStr(),