From 44fe5a69ee19f0a0d78317f4c9dfa87c63c84cf2 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Fri, 23 Jan 2004 01:25:19 +0000 Subject: [PATCH] ICU-2092 Code Review changes X-SVN-Rev: 14387 --- icu4c/source/common/rbbiscan.cpp | 9 ++++++--- icu4c/source/common/unicode/rbbi.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/icu4c/source/common/rbbiscan.cpp b/icu4c/source/common/rbbiscan.cpp index d81201182b..272f4a2654 100644 --- a/icu4c/source/common/rbbiscan.cpp +++ b/icu4c/source/common/rbbiscan.cpp @@ -89,9 +89,6 @@ U_NAMESPACE_BEGIN //---------------------------------------------------------------------------------------- RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb) { - if (U_FAILURE(*rb->fStatus)) { - return; - } fRB = rb; fStackPtr = 0; fStack[fStackPtr] = 0; @@ -117,6 +114,12 @@ RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb) fCharNum = 0; fQuoteMode = FALSE; + // Do not check status until after all critical fields are sufficiently initialized + // that the destructor can run cleanly. + if (U_FAILURE(*rb->fStatus)) { + return; + } + // // Set up the constant Unicode Sets. // Note: These could be made static, lazily initialized, and shared among diff --git a/icu4c/source/common/unicode/rbbi.h b/icu4c/source/common/unicode/rbbi.h index a8b35ad0af..90786c6bab 100644 --- a/icu4c/source/common/unicode/rbbi.h +++ b/icu4c/source/common/unicode/rbbi.h @@ -148,6 +148,8 @@ public: * whose internal tables live in a memory-mapped file. "image" is an * ICU UDataMemory handle for the pre-compiled break iterator tables. * @param image handle to the memory image for the break iterator data. + * Ownership of the UDataMemory handle passes to the Break Iterator, + * which will be responsible for closing it when it is no longer needed. * @param status Information on any errors encountered. * @see udata_open * @see #getBinaryRules