diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-01-04 14:22:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-01-04 14:22:59 +0100 |
commit | d01888302b03a79bf7ccde6cbe8434b427164a75 (patch) | |
tree | a5a3f67409e242ca62ca704ae1e4857357692e66 | |
parent | e83f31724e0f2cd4242e0b398c48578da53cb5c1 (diff) |
tdf#82775: Make NumberFormatCodeMapper MT safe
Change-Id: I77f49f09ce9fe5897f78044c0522210978c904d1
-rw-r--r-- | i18npool/inc/numberformatcode.hxx | 1 | ||||
-rw-r--r-- | i18npool/source/numberformatcode/numberformatcode.cxx | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx index 3b36cec9dcf0..9c7d78066d3e 100644 --- a/i18npool/inc/numberformatcode.hxx +++ b/i18npool/inc/numberformatcode.hxx @@ -54,6 +54,7 @@ public: throw( css::uno::RuntimeException, std::exception ) override; private: + osl::Mutex maMutex; css::lang::Locale aLocale; css::uno::Reference < css::uno::XComponentContext > mxContext; css::uno::Sequence< css::i18n::FormatElement > aFormatSeq; diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx index 76beeadabdfe..e329589cc7fb 100644 --- a/i18npool/source/numberformatcode/numberformatcode.cxx +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -44,6 +44,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, OUString elementType = mapElementTypeShortToString(formatType); OUString elementUsage = mapElementUsageShortToString(formatUsage); + osl::MutexGuard g(maMutex); getFormats( rLocale ); for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { @@ -68,6 +69,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, css::i18n::NumberFormatCode SAL_CALL NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) { + osl::MutexGuard g(maMutex); getFormats( rLocale ); for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { @@ -92,6 +94,7 @@ NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::L css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) { + osl::MutexGuard g(maMutex); getFormats( rLocale ); sal_Int32 i, count; @@ -125,6 +128,7 @@ NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL NumberFormatCodeMapper::getAllFormatCodes( const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) { + osl::MutexGuard g(maMutex); getFormats( rLocale ); css::uno::Sequence<css::i18n::NumberFormatCode> seq(aFormatSeq.getLength()); |