]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/tridpars.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / i18n / tridpars.cpp
index fd9bcfca7cafb835a5ef68f6141df9cfb50b95d2..65bfc880633a3c7800db8b9de81d277ff5e33865 100644 (file)
@@ -50,10 +50,7 @@ static UInitOnce gSpecialInversesInitOnce = U_INITONCE_INITIALIZER;
 /**
  * The mutex controlling access to SPECIAL_INVERSES
  */
-static UMutex *LOCK() {
-    static UMutex *m = STATIC_NEW(UMutex);
-    return m;
-}
+static UMutex LOCK;
 
 TransliteratorIDParser::Specs::Specs(const UnicodeString& s, const UnicodeString& t,
                                      const UnicodeString& v, UBool sawS,
@@ -297,6 +294,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
         pos = ppos.getIndex();
 
         if (withParens == 1 && !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
+            delete filter;
             pos = start;
             return NULL;
         }
@@ -662,7 +660,7 @@ void TransliteratorIDParser::registerSpecialInverse(const UnicodeString& target,
         bidirectional = FALSE;
     }
 
-    Mutex lock(LOCK());
+    Mutex lock(&LOCK);
 
     UnicodeString *tempus = new UnicodeString(inverseTarget);  // Used for null pointer check before usage.
     if (tempus == NULL) {
@@ -866,9 +864,9 @@ TransliteratorIDParser::specsToSpecialInverse(const Specs& specs, UErrorCode &st
 
     UnicodeString* inverseTarget;
 
-    umtx_lock(LOCK());
+    umtx_lock(&LOCK);
     inverseTarget = (UnicodeString*) SPECIAL_INVERSES->get(specs.target);
-    umtx_unlock(LOCK());
+    umtx_unlock(&LOCK);
 
     if (inverseTarget != NULL) {
         // If the original ID contained "Any-" then make the