summaryrefslogtreecommitdiffstats
path: root/generic/tkGet.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-04-12 07:44:45 (GMT)
committerhobbs <hobbs>2002-04-12 07:44:45 (GMT)
commit632d218946f706a8645608ee65e62efeff63c345 (patch)
tree03a8935ea7f8a51001cfdb9edd71e227d02f89f3 /generic/tkGet.c
parent6fea331b66a5bd7723f9f6a7f4e96010e7720784 (diff)
downloadtk-632d218946f706a8645608ee65e62efeff63c345.zip
tk-632d218946f706a8645608ee65e62efeff63c345.tar.gz
tk-632d218946f706a8645608ee65e62efeff63c345.tar.bz2
* generic/tkGet.c (FreeUidThreadExitProc): free thread-specific
resources on thread exit
Diffstat (limited to 'generic/tkGet.c')
-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,