diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-09-09 22:23:57 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-09-09 22:23:57 (GMT) |
commit | 4727c0c410cd50d19c06d78b4f36cfc4aa7e829d (patch) | |
tree | 8eaf41ae141685c48f89c4741ca2877212ff1e19 /unix/tkUnixRFont.c | |
parent | b1a164c0a1f1822b82ed874aa176a5e3da80122e (diff) | |
download | tk-4727c0c410cd50d19c06d78b4f36cfc4aa7e829d.zip tk-4727c0c410cd50d19c06d78b4f36cfc4aa7e829d.tar.gz tk-4727c0c410cd50d19c06d78b4f36cfc4aa7e829d.tar.bz2 |
Try to make Tk more resilient in the face of Xft allocation failures.
Diffstat (limited to 'unix/tkUnixRFont.c')
-rw-r--r-- | unix/tkUnixRFont.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 00b8095..e11015f 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixRFont.c,v 1.27 2008/11/22 18:08:51 dkf Exp $ + * RCS: @(#) $Id: tkUnixRFont.c,v 1.28 2009/09/09 22:23:58 dkf Exp $ */ #include "tkUnixInt.h" @@ -244,7 +244,6 @@ InitFont( set = FcFontSort(0, pattern, FcTrue, NULL, &result); if (!set) { - FcPatternDestroy(pattern); ckfree((char *) fontPtr); return NULL; } @@ -353,6 +352,7 @@ TkpGetNativeFont( fontPtr = InitFont(tkwin, pattern, NULL); if (!fontPtr) { + FcPatternDestroy(pattern); return NULL; } return &fontPtr->font; @@ -418,7 +418,19 @@ TkpGetFontFromAttributes( FinishedWithFont(fontPtr); } fontPtr = InitFont(tkwin, pattern, fontPtr); + + /* + * Hack to work around issues with weird issues with Xft/Xrender + * connection. + */ + if (!fontPtr) { + XftPatternAddBool(pattern, XFT_RENDER, FcFalse); + fontPtr = InitFont(tkwin, pattern, fontPtr); + } + + if (!fontPtr) { + FcPatternDestroy(pattern); return NULL; } return &fontPtr->font; |