summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2002-04-12 07:35:41 (GMT)
committerhobbs <hobbs@noemail.net>2002-04-12 07:35:41 (GMT)
commit9bc0147bb1d21e74e0482610aa5d39b3b5323849 (patch)
tree295000349ba344b19500b88f7f27b9f52b32ca01 /unix
parent9ac90e83a3942f12e5fa80659c9dc7bea9c9e2e5 (diff)
downloadtk-9bc0147bb1d21e74e0482610aa5d39b3b5323849.zip
tk-9bc0147bb1d21e74e0482610aa5d39b3b5323849.tar.gz
tk-9bc0147bb1d21e74e0482610aa5d39b3b5323849.tar.bz2
* unix/tkUnixFont.c (FontPkgCleanup): cleanup thread specific font
resources on thread exit. FossilOrigin-Name: bfad691293ad928c4d673b5f97f617c538befd8e
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixFont.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 5575e09..444eebb 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixFont.c,v 1.10 2002/03/27 00:14:06 andreas_kupries Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.11 2002/04/12 07:35:42 hobbs Exp $
*/
#include "tkUnixInt.h"
@@ -198,6 +198,7 @@ static EncodingAlias encodingAliases[] = {
* Procedures used only in this file.
*/
+static void FontPkgCleanup _ANSI_ARGS_((ClientData clientData));
static FontFamily * AllocFontFamily _ANSI_ARGS_((Display *display,
XFontStruct *fontStructPtr, int base));
static SubFont * CanUseFallback _ANSI_ARGS_((UnixFont *fontPtr,
@@ -262,6 +263,44 @@ static int UtfToUcs2beProc _ANSI_ARGS_((ClientData clientData,
/*
*-------------------------------------------------------------------------
*
+ * FontPkgCleanup --
+ *
+ * This procedure is called when an application is created. It
+ * initializes all the structures that are used by the
+ * platform-dependent code on a per application basis.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Releases thread-specific resources used by font pkg.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+FontPkgCleanup(ClientData clientData)
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (tsdPtr->controlFamily.encoding != NULL) {
+ FontFamily *familyPtr = &tsdPtr->controlFamily;
+ int i;
+
+ Tcl_FreeEncoding(familyPtr->encoding);
+ for (i = 0; i < FONTMAP_PAGES; i++) {
+ if (familyPtr->fontMap[i] != NULL) {
+ ckfree(familyPtr->fontMap[i]);
+ }
+ }
+ tsdPtr->controlFamily.encoding = NULL;
+ }
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
* TkpFontPkgInit --
*
* This procedure is called when an application is created. It
@@ -318,6 +357,7 @@ TkpFontPkgInit(mainPtr)
type.clientData = NULL;
type.nullSize = 2;
Tcl_CreateEncoding(&type);
+ Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
}
}