diff options
Diffstat (limited to 'generic/tkFont.c')
-rw-r--r-- | generic/tkFont.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c index 27303a0..bd65379 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.57 2009/09/09 22:23:58 dkf Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.58 2009/09/10 12:16:37 dkf Exp $ */ #include "tkInt.h" @@ -1188,17 +1188,22 @@ Tk_AllocFontFromObj( */ fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &fa); - if (fontPtr == NULL) { - Tcl_AppendResult(interp, "failed to allocate font due to ", - "internal font engine problem", NULL); - if (isNew) { - Tcl_DeleteHashEntry(cacheHashPtr); - } - return NULL; - } } } + /* + * 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; |