diff options
author | dgp <dgp@users.sourceforge.net> | 2014-12-17 19:57:40 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-12-17 19:57:40 (GMT) |
commit | 5c538fa1b96b4a1f0bf417d13cd4ce7f359db158 (patch) | |
tree | 5890482ba27b9156b56aec4c155eb37dd3d21fc8 /generic/tclEncoding.c | |
parent | 5e778621160b6ebe88507ef12c4f417e45dac219 (diff) | |
download | tcl-5c538fa1b96b4a1f0bf417d13cd4ce7f359db158.zip tcl-5c538fa1b96b4a1f0bf417d13cd4ce7f359db158.tar.gz tcl-5c538fa1b96b4a1f0bf417d13cd4ce7f359db158.tar.bz2 |
Revise encoding finalization so that it does a more complete job of restoring
the pre-initialized state. This makes finalization errors more repeatable
and cross-platform.
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r-- | generic/tclEncoding.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index d246cb2..95c59c0 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -180,9 +180,9 @@ TCL_DECLARE_MUTEX(encodingMutex) * the system encoding will be used to perform the conversion. */ -static Tcl_Encoding defaultEncoding; -static Tcl_Encoding systemEncoding; -Tcl_Encoding tclIdentityEncoding; +static Tcl_Encoding defaultEncoding = NULL; +static Tcl_Encoding systemEncoding = NULL; +Tcl_Encoding tclIdentityEncoding = NULL; /* * The following variable is used in the sparse matrix code for a @@ -652,7 +652,10 @@ TclFinalizeEncodingSubsystem(void) Tcl_MutexLock(&encodingMutex); encodingsInitialized = 0; FreeEncoding(systemEncoding); + systemEncoding = NULL; + defaultEncoding = NULL; FreeEncoding(tclIdentityEncoding); + tclIdentityEncoding = NULL; hPtr = Tcl_FirstHashEntry(&encodingTable, &search); while (hPtr != NULL) { @@ -2960,7 +2963,9 @@ TableFreeProc( */ ckfree(dataPtr->toUnicode); + dataPtr->toUnicode = NULL; ckfree(dataPtr->fromUnicode); + dataPtr->fromUnicode = NULL; ckfree(dataPtr); } @@ -3433,6 +3438,7 @@ EscapeFreeProc( subTablePtr = dataPtr->subTables; for (i = 0; i < dataPtr->numSubTables; i++) { FreeEncoding((Tcl_Encoding) subTablePtr->encodingPtr); + subTablePtr->encodingPtr = NULL; subTablePtr++; } } |