diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-01-04 14:22:59 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-06 13:26:00 +0000 |
commit | d4ff96c740695401acbb4bb9e6a15a3c9c14fc53 (patch) | |
tree | 303472cefca302b8371003aaf5e44a303fefd0ed /i18npool | |
parent | 0f082936e2f891ea20e6bda063b61ef0842ada8a (diff) |
tdf#82775: Make NumberFormatCodeMapper MT safe
Change-Id: I77f49f09ce9fe5897f78044c0522210978c904d1
(cherry picked from commit d01888302b03a79bf7ccde6cbe8434b427164a75)
Reviewed-on: https://gerrit.libreoffice.org/21130
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'i18npool')
-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()); |