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 | |
parent | 88e0fa4aa3bea9ffeee372b6a428ca62cee41203 (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/inc/transliterationImpl.hxx | 9 | ||||
-rw-r--r-- | i18npool/source/transliteration/transliterationImpl.cxx | 17 |
2 files changed, 14 insertions, 12 deletions
diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx index 94fba9679009..cb06d0e85ebf 100644 --- a/i18npool/inc/transliterationImpl.hxx +++ b/i18npool/inc/transliterationImpl.hxx @@ -126,15 +126,6 @@ private: com::sun::star::uno::Reference< XLocaleData > localedata; com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > caseignore; - /** structure to cache the last transliteration body used. */ - struct TransBody - { - ::osl::Mutex mutex; - ::rtl::OUString Name; - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedTransliteration > Body; - }; - static TransBody lastTransBody; - virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName, com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration> & body, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); 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( |