From 844149c7bcb337471c4f2c126bff1c1971a0ccdb Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 7 Apr 2011 05:01:42 +0000 Subject: [PATCH] ICU-8093 Enable cleanup of isoCodes X-SVN-Rev: 29753 --- icu4c/source/i18n/ucurr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/icu4c/source/i18n/ucurr.cpp b/icu4c/source/i18n/ucurr.cpp index 5dcfd6ac78d..85062e6a3aa 100644 --- a/icu4c/source/i18n/ucurr.cpp +++ b/icu4c/source/i18n/ucurr.cpp @@ -107,7 +107,9 @@ static UMTX gIsoCodesLock = NULL; static UBool U_CALLCONV isoCodes_cleanup(void) { - umtx_destroy(&gIsoCodesLock); + if (gIsoCodesLock != NULL) { + umtx_destroy(&gIsoCodesLock); + } if (gIsoCodes != NULL) { uhash_close(gIsoCodes); @@ -344,9 +346,11 @@ static UBool U_CALLCONV currency_cleanup(void) { CReg::cleanup(); #endif /* - * There might be some cached currency data. + * There might be some cached currency data or isoCodes data. */ currency_cache_cleanup(); + isoCodes_cleanup(); + return TRUE; } U_CDECL_END @@ -1931,6 +1935,8 @@ ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eError } uhash_setValueDeleter(gIsoCodes, deleteIsoCodeEntry); + ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY, currency_cleanup); + ucurr_createCurrencyList(&status); if (U_FAILURE(status)) { umtx_unlock(&gIsoCodesLock);