summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkGet.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 24b130d..95d7a54 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGet.c,v 1.8 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkGet.c,v 1.9 2002/04/12 07:44:45 hobbs Exp $
*/
#include "tkInt.h"
@@ -32,6 +32,8 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
+static void FreeUidThreadExitProc _ANSI_ARGS_((ClientData clientData));
+
/*
* The following tables defines the string values for reliefs, which are
* used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj.
@@ -484,6 +486,32 @@ Tk_NameOfJustify(justify)
/*
*----------------------------------------------------------------------
*
+ * FreeUidThreadExitProc --
+ *
+ * Cleans up memory used for Tk_Uids in the thread.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * All information in the identifier table is deleted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FreeUidThreadExitProc(clientData)
+ ClientData clientData; /* Not used. */
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_DeleteHashTable(&tsdPtr->uidTable);
+ tsdPtr->initialized = 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tk_GetUid --
*
* Given a string, this procedure returns a unique identifier
@@ -515,6 +543,7 @@ Tk_GetUid(string)
if (!tsdPtr->initialized) {
Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS);
+ Tcl_CreateThreadExitHandler(FreeUidThreadExitProc, NULL);
tsdPtr->initialized = 1;
}
return (Tk_Uid) Tcl_GetHashKey(tablePtr,