[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - vcl/win
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 17 16:04:15 UTC 2020
vcl/win/dtrans/WinClipboard.cxx | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 28c6f0016e16338db53e41a4d13f0e60554d692d
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Dec 14 10:47:04 2020 +0100
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Dec 17 17:03:41 2020 +0100
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 at fbihome.de>
(cherry picked from commit f5ab8bcbfd20ecce4a358f62ee3f81b8b968a5de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107894
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
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();
}
More information about the Libreoffice-commits
mailing list