diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-09-30 22:33:33 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-10-01 09:47:51 +0200 |
commit | d12d236bac476ba39ee41b7d5bc7b849b4fd52c6 (patch) | |
tree | 81a54da053b57503d790b6399ed11d9fdafefe43 /vcl/win/dtrans | |
parent | 5204be412e0e0fc138b82f886b83d5b8e0e77dd2 (diff) |
Use the new single-instance="true" attribute in vcl
Change-Id: I6067761fda821b90fdd5c57a2c934c9626e92fdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103739
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/win/dtrans')
-rw-r--r-- | vcl/win/dtrans/WinClipboard.cxx | 28 | ||||
-rw-r--r-- | vcl/win/dtrans/WinClipboard.hxx | 2 |
2 files changed, 1 insertions, 29 deletions
diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx index 17477fd8d16d..de6ecb775838 100644 --- a/vcl/win/dtrans/WinClipboard.cxx +++ b/vcl/win/dtrans/WinClipboard.cxx @@ -19,8 +19,6 @@ #include <sal/config.h> -#include <mutex> - #include <osl/diagnose.h> #include <com/sun/star/datatransfer/clipboard/ClipboardEvent.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -28,7 +26,6 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> -#include <rtl/ref.hxx> #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> #include "XNotifyingDataObject.hxx" @@ -301,27 +298,11 @@ uno::Sequence<OUString> SAL_CALL CWinClipboard::getSupportedServiceNames() return { "com.sun.star.datatransfer.clipboard.SystemClipboard" }; } -namespace -{ -std::mutex g_InstanceGuard; -rtl::Reference<CWinClipboard> g_Instance; -bool g_Disposed = false; -} - extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* dtrans_CWinClipboard_get_implementation(css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - std::scoped_lock l(g_InstanceGuard); - if (g_Disposed) - { - return nullptr; - } - if (!g_Instance.is()) - { - g_Instance.set(new CWinClipboard(context, "")); - } - return cppu::acquire(static_cast<cppu::OWeakObject*>(g_Instance.get())); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new CWinClipboard(context, ""))); } void CWinClipboard::onReleaseDataObject(CXNotifyingDataObject* theCaller) @@ -358,11 +339,4 @@ void WINAPI CWinClipboard::onClipboardContentChanged() } } -void CWinClipboard::disposing() -{ - std::scoped_lock l(g_InstanceGuard); - g_Instance.clear(); - g_Disposed = true; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/WinClipboard.hxx b/vcl/win/dtrans/WinClipboard.hxx index 984a07a22dd7..1b0a05a3450d 100644 --- a/vcl/win/dtrans/WinClipboard.hxx +++ b/vcl/win/dtrans/WinClipboard.hxx @@ -82,8 +82,6 @@ class CWinClipboard final static void WINAPI onClipboardContentChanged(); - void SAL_CALL disposing() override; - public: CWinClipboard(const css::uno::Reference<css::uno::XComponentContext>& rxContext, const OUString& aClipboardName); |