From 705755a025962f75421092a8ace8fcb2046e9dae Mon Sep 17 00:00:00 2001 From: Travis Keep Date: Tue, 11 Mar 2014 21:18:34 +0000 Subject: [PATCH] ICU-10700 From Markus' review comments. X-SVN-Rev: 35408 --- icu4c/source/i18n/unicode/calendar.h | 9 +++++++++ icu4c/source/i18n/unicode/translit.h | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/unicode/calendar.h b/icu4c/source/i18n/unicode/calendar.h index c7e221d711a..6ef85095d58 100644 --- a/icu4c/source/i18n/unicode/calendar.h +++ b/icu4c/source/i18n/unicode/calendar.h @@ -2348,6 +2348,11 @@ private: /** * Register a new Calendar factory. The factory will be adopted. * INTERNAL in 2.6 + * + * Because ICU may choose to cache Calendars internally, this must + * be called at application startup, prior to any calls to + * Calendar::createInstance to avoid undefined behavior. + * * @param toAdopt the factory instance to be adopted * @param status the in/out status code, no special meanings are assigned * @return a registry key that can be used to unregister this factory @@ -2361,6 +2366,10 @@ private: * The CalendarFactory corresponding to the key will be deleted. * INTERNAL in 2.6 * @param key the registry key returned by a previous call to registerFactory + * Because ICU may choose to cache Calendars internally, this should + * be called during application shutdown, after all calls to + * Calendar::createInstance to avoid undefined behavior. + * * @param status the in/out status code, no special meanings are assigned * @return TRUE if the factory for the key was successfully unregistered * @internal diff --git a/icu4c/source/i18n/unicode/translit.h b/icu4c/source/i18n/unicode/translit.h index 469e94316d9..4973d424715 100644 --- a/icu4c/source/i18n/unicode/translit.h +++ b/icu4c/source/i18n/unicode/translit.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2013, International Business Machines +* Copyright (C) 1999-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -965,6 +965,11 @@ public: /** * Registers a factory function that creates transliterators of * a given ID. + * + * Because ICU may choose to cache Transliterators internally, this must + * be called at application startup, prior to any calls to + * Transliterator::createXXX to avoid undefined behavior. + * * @param id the ID being registered * @param factory a function pointer that will be copied and * called later when the given ID is passed to createInstance() @@ -987,6 +992,10 @@ public: * After this call the Transliterator class owns the adoptedObj * and will delete it. * + * Because ICU may choose to cache Transliterators internally, this must + * be called at application startup, prior to any calls to + * Transliterator::createXXX to avoid undefined behavior. + * * @param adoptedObj an instance of subclass of * Transliterator that defines clone() * @see #createInstance @@ -1085,6 +1094,10 @@ public: * Any attempt to construct an unregistered transliterator based * on its ID will fail. * + * Because ICU may choose to cache Transliterators internally, this should + * be called during application shutdown, after all calls to + * Transliterator::createXXX to avoid undefined behavior. + * * @param ID the ID of the transliterator or class * @return the Object that was registered with * ID, or null if none was -- 2.40.0