ICU-6076 Prevent a double mutex lock when the following happens.

ucol_open -> u_cleanup -> ures_open same locale.
Notice that the collator leaked, which contained open resource bundles. The resource bundle API didn't recover very well from this experience, and a double mutex lock happens, which is hard to debug in the test framework.

This change will make it easier to test the -m option, reduce open resources while a collator is running and make it easier to segment the collator for static libraries.

X-SVN-Rev: 23107
This commit is contained in:
George Rhoten 2007-12-18 01:31:11 +00:00
parent 344e2283d7
commit 7ecc972c39

View File

@ -1956,7 +1956,7 @@ public:
uint8_t*result, int32_t resultLength) const;
virtual UnicodeSet *getTailoredSet(UErrorCode &status) const;
virtual UBool operator!=(const Collator& other) const;
virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale);
virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale);
TestCollator() : Collator() {};
TestCollator(UCollationStrength collationStrength,
UNormalizationMode decompositionMode) : Collator(collationStrength, decompositionMode) {};
@ -2155,9 +2155,9 @@ UnicodeSet * TestCollator::getTailoredSet(UErrorCode &status) const
return Collator::getTailoredSet(status);
}
void TestCollator::setLocales(const Locale& requestedLocale, const Locale& validLocale)
void TestCollator::setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale)
{
Collator::setLocales(requestedLocale, validLocale);
Collator::setLocales(requestedLocale, validLocale, actualLocale);
}
@ -2196,7 +2196,7 @@ void CollationAPITest::TestSubclass()
// use base class implementation
Locale loc1 = Locale::getGermany();
Locale loc2 = Locale::getFrance();
col1.setLocales(loc1, loc2); // default implementation has no effect
col1.setLocales(loc1, loc2, loc2); // default implementation has no effect
UnicodeString displayName;
col1.getDisplayName(loc1, loc2, displayName); // de_DE collator in fr_FR locale