[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - i18npool/inc i18npool/source

Stephan Bergmann sbergman at redhat.com
Wed Jan 6 05:26:21 PST 2016


 i18npool/inc/numberformatcode.hxx                     |    1 +
 i18npool/source/numberformatcode/numberformatcode.cxx |    4 ++++
 2 files changed, 5 insertions(+)

New commits:
commit d4ff96c740695401acbb4bb9e6a15a3c9c14fc53
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 4 14:22:59 2016 +0100

    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 at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx
index 3b36cec..9c7d780 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 76beead..e329589 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());


More information about the Libreoffice-commits mailing list