diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 67a0aa11fe5c..7461bb743ccc 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -1647,7 +1647,9 @@ void DecimalFormat::touch(UErrorCode& status) { delete fields->atomicCurrencyParser.exchange(nullptr); #else delete fields->atomicParser; + fields->atomicParser = nullptr; delete fields->atomicCurrencyParser; + fields->atomicCurrencyParser = nullptr; #endif // In order for the getters to work, we need to populate some fields in NumberFormat. diff --git a/icu4c/source/i18n/number_mapper.h b/icu4c/source/i18n/number_mapper.h index def4fec594d6..afac55415b5c 100644 --- a/icu4c/source/i18n/number_mapper.h +++ b/icu4c/source/i18n/number_mapper.h @@ -201,7 +201,7 @@ struct DecimalFormatFields : public UMemory { #if U_HAVE_ATOMICS std::atomic<::icu::numparse::impl::NumberParserImpl*> atomicParser = {}; #else - ::icu::numparse::impl::NumberParserImpl* atomicParser = nullptr; + ::icu::numparse::impl::NumberParserImpl* atomicParser = {}; #endif /** The lazy-computed parser for .parseCurrency() */