summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-12-14 10:47:04 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2020-12-17 17:03:41 +0100
commit28c6f0016e16338db53e41a4d13f0e60554d692d (patch)
treebe40b8689e531b29417292d7f31980586ab5ac99
parent629c2bac961bfac76795b5e11535484b8903233b (diff)
WIN don't notify clipboard change with SolarMutex
Regression from commit 52a7eb58f5c137b6de76cc49be07dd43c42a6d6c ("WIN replace clipboard update thread with Idle"). Previously the notification was done without the SolarMutex. Now it's run via an Idle and SolarMutex is required by the Scheduler, so release it. Foreign contents is again protected by the clipboard lock. And also unlock the SolarMutex in getContents, to prevent a deadlock in the clipboard STA thread, if it's already processing other request, like CXNotifyingDataObject::GetData, blocking on the SolarMutex. Change-Id: I6855b045b3065289ec7833498f6785ee31eda61c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107675 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> (cherry picked from commit f5ab8bcbfd20ecce4a358f62ee3f81b8b968a5de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107894 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--vcl/win/dtrans/WinClipboard.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 6446a33e4574..6d1b03b0887e 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -26,6 +26,8 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp>
#include "XNotifyingDataObject.hxx"
@@ -89,6 +91,9 @@ CWinClipboard::~CWinClipboard()
uno::Reference<datatransfer::XTransferable> SAL_CALL CWinClipboard::getContents()
{
+ DBG_TESTSOLARMUTEX();
+ SolarMutexReleaser aReleaser;
+
osl::MutexGuard aGuard(m_aMutex);
if (rBHelper.bDisposed)
@@ -242,7 +247,8 @@ void SAL_CALL CWinClipboard::removeClipboardListener(
IMPL_LINK_NOARG(CWinClipboard, ClipboardContentChangedHdl, Timer*, void)
{
- m_foreignContent.clear();
+ DBG_TESTSOLARMUTEX();
+ SolarMutexReleaser aReleaser;
if (rBHelper.bDisposed)
return;
@@ -260,7 +266,11 @@ IMPL_LINK_NOARG(CWinClipboard, ClipboardContentChangedHdl, Timer*, void)
try
{
cppu::OInterfaceIteratorHelper iter(*pICHelper);
- uno::Reference<datatransfer::XTransferable> rXTransf(getContents());
+ uno::Reference<datatransfer::XTransferable> rXTransf;
+ {
+ SolarMutexGuard aGuard;
+ rXTransf.set(getContents());
+ }
datatransfer::clipboard::ClipboardEvent aClipbEvent(static_cast<XClipboard*>(this),
rXTransf);
@@ -341,6 +351,8 @@ void WINAPI CWinClipboard::onWM_CLIPBOARDUPDATE()
if (!s_pCWinClipbImpl)
return;
+ s_pCWinClipbImpl->m_foreignContent.clear();
+
if (!s_pCWinClipbImpl->m_aNotifyClipboardChangeIdle.IsActive())
s_pCWinClipbImpl->m_aNotifyClipboardChangeIdle.Start();
}