You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2023/02/19 08:51:32 UTC

[openoffice] branch bug126680 created (now 5c7145b86d)

This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a change to branch bug126680
in repository https://gitbox.apache.org/repos/asf/openoffice.git


      at 5c7145b86d Do not cache instances of com.sun.star.i18n.Transliteration.l10n

This branch includes the following new commits:

     new 5c7145b86d Do not cache instances of com.sun.star.i18n.Transliteration.l10n

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[openoffice] 01/01: Do not cache instances of com.sun.star.i18n.Transliteration.l10n

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch bug126680
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 5c7145b86d2597c41a7f64169c759190e6037945
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Sun Feb 19 09:45:46 2023 +0100

    Do not cache instances of com.sun.star.i18n.Transliteration.l10n
    
    Such instances may be modified by the callers. If objects are cached,
    one caller may see its instance unexpectedly modified by another caller.
    
    This happened with Transliteration_caseignore instances  in bug #126680.
---
 main/i18npool/inc/transliterationImpl.hxx                   |  9 ---------
 .../i18npool/source/transliteration/transliterationImpl.cxx | 13 -------------
 2 files changed, 22 deletions(-)

diff --git a/main/i18npool/inc/transliterationImpl.hxx b/main/i18npool/inc/transliterationImpl.hxx
index 5cd3c7b2bd..74b827b873 100644
--- a/main/i18npool/inc/transliterationImpl.hxx
+++ b/main/i18npool/inc/transliterationImpl.hxx
@@ -121,15 +121,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/main/i18npool/source/transliteration/transliterationImpl.cxx b/main/i18npool/source/transliteration/transliterationImpl.cxx
index 8b68415484..2141fd5859 100644
--- a/main/i18npool/source/transliteration/transliterationImpl.cxx
+++ b/main/i18npool/source/transliteration/transliterationImpl.cxx
@@ -144,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)
 {
@@ -591,15 +589,6 @@ TransliterationImpl::clear()
 void TransliterationImpl::loadBody( OUString &implName, Reference<XExtendedTransliteration>& body ) 
     throw (RuntimeException)
 {
-    ::osl::MutexGuard guard(lastTransBody.mutex);
-
-    if (implName.equals(lastTransBody.Name))
-    {
-        // Use the cached body instead of going through the expensive looping again.
-        body = lastTransBody.Body;
-        return;
-    }
-
     Reference< XContentEnumerationAccess > xEnumAccess( xSMgr, UNO_QUERY );
     Reference< XEnumeration > xEnum(xEnumAccess->createContentEnumeration(
                                     OUString::createFromAscii(TRLT_SERVICELNAME_L10N)));
@@ -616,8 +605,6 @@ void TransliterationImpl::loadBody( OUString &implName, Reference<XExtendedTrans
                             a = xI->queryInterface(::getCppuType((
                                         const Reference<XExtendedTransliteration>*)0));
                             a >>= body;
-                            lastTransBody.Name = implName;
-                            lastTransBody.Body = body;
                             return;
                         }
                     }