This is an automated email from the ASF dual-hosted git repository. ardovm pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 2a19c4c2b3 Do not cache instances of com.sun.star.i18n.Transliteration.l10n 2a19c4c2b3 is described below commit 2a19c4c2b3b9385d8893e4a44875be5775525cd0 Author: Arrigo Marchiori <ard...@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. (cherry picked from commit f0439fff86115a6959e104fea345d175528afdf0) --- 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; } }