[Libreoffice-commits] core.git: sc/qa vcl/inc vcl/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 8 09:34:26 UTC 2020
sc/qa/uitest/calc_tests2/tdf118189.py | 2 +-
vcl/inc/salinst.hxx | 1 +
vcl/source/components/dtranscomp.cxx | 27 ++++++++++++++++++++++++---
3 files changed, 26 insertions(+), 4 deletions(-)
New commits:
commit 68c3d3e46bf731c93fe5eca2e35042484f77d650
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Apr 8 09:26:38 2020 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Apr 8 11:33:46 2020 +0200
Make SalInstance::CreateClipboard return a single instance in the non-LOK case
I came across this when seeing UITest_calc_tests2's
tdf118189.tdf118189.test_tdf118189 fail on Linux with SAL_USE_VCLPLUGIN=gen and
also on Windows, see the mailing list thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2020-April/084822.html>
"Linux SAL_USE_VCLPLUGIN=svp and the clipboard". That email thread clarified
that the codified behavior of that non-LOK test was wrong. (While the LOK test
ScTiledRenderingTest::testMultiViewCopyPaste in
sc/qa/unit/tiledrendering/tiledrendering.cxx keeps working as intended.)
I did not find documentation for what arguments CreateClipboard shall support,
but things seem to work if anything but empty arguments is rejected with an
IllegalArgumentException.
Change-Id: I1918254cc15878ad43b8aa22aff7eb1c4bea73fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91869
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sc/qa/uitest/calc_tests2/tdf118189.py b/sc/qa/uitest/calc_tests2/tdf118189.py
index ed33b20bcbee..e49a471fd40a 100644
--- a/sc/qa/uitest/calc_tests2/tdf118189.py
+++ b/sc/qa/uitest/calc_tests2/tdf118189.py
@@ -46,7 +46,7 @@ class tdf118189(UITestCase):
self.xUITest.executeCommand(".uno:Undo")
#-> CRASH
- self.assertEqual(get_cell_by_position(document2, 0, 0, 0).getString(), "")
+ self.assertEqual(get_cell_by_position(document2, 0, 0, 0).getString(), "On Back Order")
self.ui_test.close_doc()
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 621343677078..36c51d990d5c 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -82,6 +82,7 @@ class VCL_DLLPUBLIC SalInstance
private:
rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
const std::unique_ptr<comphelper::SolarMutex> m_pYieldMutex;
+ css::uno::Reference<css::uno::XInterface> m_clipboard;
public:
SalInstance(std::unique_ptr<comphelper::SolarMutex> pMutex);
diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index e76e7691ded8..c7bda5361fdb 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -17,14 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <osl/mutex.hxx>
+#include <sal/config.h>
+#include <comphelper/lok.hxx>
+#include <osl/mutex.hxx>
+#include <tools/debug.hxx>
#include <vcl/svapp.hxx>
#include <factory.hxx>
#include <svdata.hxx>
#include <salinst.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -452,9 +456,26 @@ Reference< XInterface > DropTarget_createInstance( const Reference< XMultiServic
/*
* SalInstance generic
*/
-Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& )
+Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& arguments )
{
- return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()) );
+ if (arguments.hasElements()) {
+ throw css::lang::IllegalArgumentException(
+ "non-empty SalInstance::CreateClipboard arguments", {}, -1);
+ }
+ if (comphelper::LibreOfficeKit::isActive()) {
+ // In LOK, each document view shall have its own clipboard instance, and the way that
+ // (happens to?) work is that apparently this function is called at most once for each such
+ // document view, so it is OK if we hand out a fresh instance on each call in LOK (whereas
+ // in non-LOK below we keep handing out one single instance; see also
+ // <https://lists.freedesktop.org/archives/libreoffice/2020-April/084824.html> "Re: Linux
+ // SAL_USE_VCLPLUGIN=svp and the clipboard"):
+ return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()) );
+ }
+ DBG_TESTSOLARMUTEX();
+ if (!m_clipboard.is()) {
+ m_clipboard = static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard());
+ }
+ return m_clipboard;
}
Reference< XInterface > SalInstance::CreateDragSource()
More information about the Libreoffice-commits
mailing list