diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-03-23 11:11:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-23 19:49:25 +0000 |
commit | e7dbef922a2fc73469f12c520bcc1af54fe038fb (patch) | |
tree | 02c18e1d1c9d0d85914626f66ace24a79f892e79 /framework/source/accelerators | |
parent | 462ebbd10bd537f42104fe991a0aeebcd563f178 (diff) |
rtl::Static to thread-safe-static
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/accelerators')
-rw-r--r-- | framework/source/accelerators/presethandler.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 7bd487684555..0572049ab785 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -65,7 +65,11 @@ struct TSharedStorages final a) shared root storages b) shared "inbetween" storages of the share and user layer. */ -struct SharedStorages: public rtl::Static<TSharedStorages, SharedStorages> {}; +TSharedStorages& SharedStorages() +{ + static TSharedStorages theStorages; + return theStorages; +} } @@ -103,7 +107,7 @@ PresetHandler::~PresetHandler() Otherwise we will disconnect all other open configuration access objects which base on these storages. */ - auto & sharedStorages = SharedStorages::get(); + auto & sharedStorages = SharedStorages(); sharedStorages.m_lStoragesShare.closePath(m_sRelPathShare); sharedStorages.m_lStoragesUser.closePath (m_sRelPathUser ); @@ -169,7 +173,7 @@ void lcl_throwCorruptedUIConfigurationException( css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageShare() { - auto & sharedStorages = SharedStorages::get(); + auto & sharedStorages = SharedStorages(); css::uno::Reference< css::embed::XStorage > xRoot = sharedStorages.m_lStoragesShare.getRootStorage(); if (xRoot.is()) return xRoot; @@ -228,7 +232,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageUser() { - auto & sharedStorages = SharedStorages::get(); + auto & sharedStorages = SharedStorages(); css::uno::Reference< css::embed::XStorage > xRoot = sharedStorages.m_lStoragesUser.getRootStorage(); if (xRoot.is()) return xRoot; @@ -287,7 +291,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare xWorking = m_xWorkingStorageShare; } - return SharedStorages::get().m_lStoragesShare.getParentStorage(xWorking); + return SharedStorages().m_lStoragesShare.getParentStorage(xWorking); } css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser() @@ -298,7 +302,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser( xWorking = m_xWorkingStorageUser; } - return SharedStorages::get().m_lStoragesUser.getParentStorage(xWorking); + return SharedStorages().m_lStoragesUser.getParentStorage(xWorking); } void PresetHandler::connectToResource( PresetHandler::EConfigType eConfigType , @@ -538,7 +542,7 @@ void PresetHandler::commitUserChanges() case E_GLOBAL : case E_MODULES : { - auto & sharedStorages = SharedStorages::get(); + auto & sharedStorages = SharedStorages(); sPath = sharedStorages.m_lStoragesUser.getPathOfStorage(xWorking); sharedStorages.m_lStoragesUser.commitPath(sPath); sharedStorages.m_lStoragesUser.notifyPath(sPath); @@ -573,7 +577,7 @@ void PresetHandler::addStorageListener(XMLBasedAcceleratorConfiguration* pListen case E_GLOBAL : case E_MODULES : { - SharedStorages::get().m_lStoragesUser.addStorageListener(pListener, sRelPath); + SharedStorages().m_lStoragesUser.addStorageListener(pListener, sRelPath); } break; @@ -603,7 +607,7 @@ void PresetHandler::removeStorageListener(XMLBasedAcceleratorConfiguration* pLis case E_GLOBAL : case E_MODULES : { - SharedStorages::get().m_lStoragesUser.removeStorageListener(pListener, sRelPath); + SharedStorages().m_lStoragesUser.removeStorageListener(pListener, sRelPath); } break; @@ -623,9 +627,9 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring try { if (bShare) - xPath = SharedStorages::get().m_lStoragesShare.openPath(sPath, eMode); + xPath = SharedStorages().m_lStoragesShare.openPath(sPath, eMode); else - xPath = SharedStorages::get().m_lStoragesUser.openPath(sPath, eMode); + xPath = SharedStorages().m_lStoragesUser.openPath(sPath, eMode); } catch(const css::uno::RuntimeException&) { throw; } |