summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-24 19:40:35 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-25 09:22:55 +0200
commitf0c49bd1554885ed601ae9a9507a5689b2cc7914 (patch)
treeaa8db91ede97c2f4e1c72515d27abddea9c86783 /desktop/source
parent8bcdd32f2fbb8825564ec4eeabe1d6f3eed808ce (diff)
cid#1633781 Initialization or destruction ordering is unspecified
and cid#1633780 Initialization or destruction ordering is unspecified cid#1633778 Initialization or destruction ordering is unspecified cid#1633777 Initialization or destruction ordering is unspecified cid#1633776 Initialization or destruction ordering is unspecified Change-Id: I8ae7cbede6df2ad747fe57d0ac2800e1b6a31038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175576 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/lokclipboard.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 99f803523d40..c64a9ecd9cb2 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -20,7 +20,12 @@ using namespace css;
using namespace css::uno;
/* static */ osl::Mutex LOKClipboardFactory::gMutex;
-static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> gClipboards{};
+static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>& getClipboards()
+{
+ static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>
+ gClipboards{};
+ return gClipboards;
+}
rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
{
@@ -28,6 +33,7 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
osl::MutexGuard aGuard(gMutex);
+ auto& gClipboards = getClipboards();
auto it = gClipboards.get()->find(nViewId);
if (it != gClipboards.get()->end())
{
@@ -44,6 +50,7 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId)
{
osl::MutexGuard aGuard(gMutex);
+ auto& gClipboards = getClipboards();
if (nViewId < 0) // clear all
{
gClipboards.get()->clear();