Tk Source Code

View Ticket
Login
Ticket UUID: 1440417
Title: Xft segfaults if fontconfig cannot find any font
Type: Bug Version: obsolete: 8.5a4
Submitter: fridolin Created on: 2006-02-28 16:07:34
Subsystem: 46. Unix Fonts Assigned To: jenglish
Priority: 3 Low Severity:
Status: Closed Last Modified: 2008-05-05 00:38:11
Resolution: Fixed Closed By: jenglish
    Closed on: 2008-05-04 17:38:11
Description:
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
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclBasic.o"
dbx: warning: see `help finding-files'
  [5] TclEvalObjvInternal(0x29eb8, 0x2, 0x2abc4, 0x0,
0x0, 0x0), at
0xfefdf2a4
dbx: warning: can't find file
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclExecute.o"
  [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
0xfefe0814
dbx: warning: can't find file
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclHistory.o"
  [9] Tcl_RecordAndEvalObj(0x29eb8, 0x9c6a0, 0x20000,
0x7efefeff,
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
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclIO.o"
  [12] Tcl_NotifyChannel(0x5ab78, 0x2, 0xfef1a000, 0x0,
0x38780, 0x0), at
0xff077384
dbx: warning: can't find file
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclUnixNotfy.o"
  [13] FileHandlerEventProc(0x43000, 0xfffffffd, 0x0,
0x1, 0x29dac,
0xffbeece0), at 0xff105c00
dbx: warning: can't find file
"/projekte/backup/tools/unix/build/tcl/tcl/unix/suns8/tclNotify.o"
  [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
"tkAppInit.c"

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,
&result);

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

here set is NULL.
User Comments: jenglish added on 2008-05-05 00:38:11:
Logged In: YES 
user_id=68433
Originator: NO

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

jenglish added on 2006-03-03 06:13:06:
Logged In: YES 
user_id=68433

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...

fridolin added on 2006-02-28 23:11:26:
Logged In: YES 
user_id=13583

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.