diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-04-19 21:16:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-19 21:35:42 +0100 |
commit | 791687613a66c13ee9f5f12b9859bc4ed0eff67e (patch) | |
tree | ab6f07fc2078e9d8f8eacabd90741e738f4ab8d6 /i18npool/source/transliteration/transliterationImpl.cxx | |
parent | 88e0fa4aa3bea9ffeee372b6a428ca62cee41203 (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'i18npool/source/transliteration/transliterationImpl.cxx')
-rw-r--r-- | i18npool/source/transliteration/transliterationImpl.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 5e9f621084ea..009f6e3c4a54 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <comphelper/processfactory.hxx> +#include <rtl/instance.hxx> #include <rtl/string.h> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -143,8 +144,6 @@ static struct TMlist { {(TransliterationModules)0, (TransliterationModulesNew)0, NULL} }; -TransliterationImpl::TransBody TransliterationImpl::lastTransBody; - // Constructor/Destructor TransliterationImpl::TransliterationImpl(const Reference <XMultiServiceFactory>& xMSF) : xSMgr(xMSF) { @@ -587,11 +586,23 @@ TransliterationImpl::clear() caseignoreOnly = sal_True; } +namespace +{ + /** structure to cache the last transliteration body used. */ + struct TransBody + { + ::rtl::OUString Name; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedTransliteration > Body; + }; + class theTransBodyMutex : public rtl::Static<osl::Mutex, theTransBodyMutex> {}; +} + void TransliterationImpl::loadBody( OUString &implName, Reference<XExtendedTransliteration>& body ) throw (RuntimeException) { assert(!implName.isEmpty()); - ::osl::MutexGuard guard(lastTransBody.mutex); + ::osl::MutexGuard guard(theTransBodyMutex::get()); + static TransBody lastTransBody; if (implName != lastTransBody.Name) { lastTransBody.Body.set( |