#2025 Xft segfaults if fontconfig cannot find any font

obsolete: 8.5a4

on SunOS 5.8 wish8.5 gets a segmentation fault.
Interactive it
could be reprocuded by

$ wish
% listbox .lb

signal SEGV (no mapping at the fault address) in
Tk_AllocFontFromObj at line
1094 in file "tkFont.c"
1094 fontPtr->resourceRefCount = 1;
(/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) where
=>[1] Tk_AllocFontFromObj(interp = 0x29eb8, tkwin =
0x760b8, objPtr =
0x70558), line 1094 in "tkFont.c"
[2] DoObjConfig(interp = 0x29eb8, recordPtr = 0x767b8
"", optionPtr =
0x77a98, valuePtr = 0x70558, tkwin = 0x760b8,
savedOptionPtr = (nil)), line
775 in "tkConfig.c"
[3] Tk_InitOptions(interp = 0x29eb8, recordPtr =
0x767b8 "", optionTable =
0x779b0, tkwin = 0x760b8), line 556 in "tkConfig.c"
[4] Tk_ListboxObjCmd(clientData = (nil), interp =
0x29eb8, objc = 2, objv
= 0x2abc4), line 561 in "tkListbox.c"
dbx: warning: can't find file
dbx: warning: see `help finding-files'
[5] TclEvalObjvInternal(0x29eb8, 0x2, 0x2abc4, 0x0,
0x0, 0x0), at
dbx: warning: can't find file
[6] TclExecuteByteCode(0x29eb8, 0x67378, 0xff3e79ec,
0x0, 0x673e4,
0x2abc8), at 0xff041d18
[7] TclCompEvalObj(0x29eb8, 0x9c6a0, 0x0, 0x7efefeff,
0x67378, 0x29eb8),
at 0xff03eb74
[8] Tcl_EvalObjEx(0x29eb8, 0x9c6a0, 0x20000, 0x0,
0xa, 0x29eb8), at
dbx: warning: can't find file
[9] Tcl_RecordAndEvalObj(0x29eb8, 0x9c6a0, 0x20000,
0x81010100, 0x37a30), at 0xff062334
[10] Tcl_RecordAndEval(0x29eb8, 0x34c78, 0x20000,
0x5ab78, 0x22304,
0x9c6a0), at 0xff062168
[11] StdinProc(clientData = 0x5ab78, mask = 2), line
376 in "tkMain.c"
dbx: warning: can't find file
[12] Tcl_NotifyChannel(0x5ab78, 0x2, 0xfef1a000, 0x0,
0x38780, 0x0), at
dbx: warning: can't find file
[13] FileHandlerEventProc(0x43000, 0xfffffffd, 0x0,
0x1, 0x29dac,
0xffbeece0), at 0xff105c00
dbx: warning: can't find file
[14] Tcl_ServiceEvent(0xfffffffd, 0xfffffffd,
0xff390018, 0xff3e7fe8, 0x0,
0x2), at 0xff0a21ec
[15] Tcl_DoOneEvent(0x0, 0x59b78, 0x0, 0x1, 0x1,
0x37a18), at 0xff0a28d4
[16] Tk_MainLoop(), line 2143 in "tkEvent.c"
[17] Tk_MainEx(argc = -1, argv = 0xffbef1a0,
appInitProc = 0x11510 =
&Tcl_AppInit(Tcl_Interp *interp), interp = 0x29eb8),
line 308 in "tkMain.c"
[18] main(argc = 1, argv = 0xffbef19c), line 68 in

wish cannot load a font. in tkFont.c

(1090) fontPtr = TkpGetFontFromAttributes(NULL,
tkwin, &fa);

The Nullpointer comes from here:

tkUnixRFont.c: 143
set = FcFontSort(0, pattern, FcTrue, &charset,

if (!set) {
ckfree((char *) fontPtr);
return NULL;

here set is NULL.


  • Christoph Bauer

    Christoph Bauer - 2006-02-28

    Logged In: YES

    Please note that my fontconfig installation wasn't quite
    correct. The fonts are installed in /usr/openwin/...
    With a correct fonts.conf, it seems to work.

    On the other side a segfault is never nice and should be
    catched. The best would be a fallback handling for such a
    case. But someone can argue that a runtime error is better.

  • Joe English

    Joe English - 2006-03-02
    • priority: 5 --> 3
    • assigned_to: hobbs --> jenglish
  • Joe English

    Joe English - 2006-03-02

    Logged In: YES

    Agreed, this should be fixed -- Tk should never, ever crash,
    even on misconfigured systems. Not sure yet what a
    reasonable fallback behavior would be or how to implement it...

  • Joe English

    Joe English - 2008-05-04

    Logged In: YES
    Originator: NO

    Believed to be fixed now (2008-03-12, see also #1090382)

  • Joe English

    Joe English - 2008-05-04
    • status: open --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks