diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-09-10 12:16:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-09-10 12:16:37 (GMT) |
commit | d5445b6e40de90dcbe3b80b515fbf3d1bfdace33 (patch) | |
tree | 873b8ffc2bc789f765f7cd6af8de620fa2ae9516 | |
parent | 357aee3aedbf35f2194b0e468c62228b3262259e (diff) | |
download | tk-d5445b6e40de90dcbe3b80b515fbf3d1bfdace33.zip tk-d5445b6e40de90dcbe3b80b515fbf3d1bfdace33.tar.gz tk-d5445b6e40de90dcbe3b80b515fbf3d1bfdace33.tar.bz2 |
Put the armouring in the right place.
-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; |