summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkFont.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 3839ef0..4852f14 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFont.c,v 1.42.2.2 2009/05/13 21:49:12 patthoyts Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.42.2.3 2009/09/10 12:47:15 dkf Exp $
*/
#include "tkInt.h"
@@ -1194,6 +1194,19 @@ Tk_AllocFontFromObj(
}
}
+ /*
+ * Detect the system font engine going wrong and fail more gracefully.
+ */
+
+ if (fontPtr == NULL) {
+ if (isNew) {
+ Tcl_DeleteHashEntry(cacheHashPtr);
+ }
+ Tcl_AppendResult(interp, "failed to allocate font due to ",
+ "internal system font engine problem", NULL);
+ return NULL;
+ }
+
fontPtr->resourceRefCount = 1;
fontPtr->objRefCount = 1;
fontPtr->cacheHashPtr = cacheHashPtr;