Posted to tcl by Emiliano at Thu Oct 11 18:38:44 GMT 2007view pretty

emiliano@maq033:~/tcl_sources$ gdb wish8.5
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
(gdb) run fuentes.tcl 
Starting program: /home/emiliano/programas/bin/wish8.5 fuentes.tcl

Program received signal SIGSEGV, Segmentation fault.
0xbbbac044 in InitFont (tkwin=0x8246500, pattern=0x824f720, fontPtr=0x81a0300)
    at /home/emiliano/tcl_sources/tk/unix/../unix/tkUnixRFont.c:177
177         if (XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0,
(gdb) bt full
#0  0xbbbac044 in InitFont (tkwin=0x8246500, pattern=0x824f720, fontPtr=0x81a0300)
    at /home/emiliano/tcl_sources/tk/unix/../unix/tkUnixRFont.c:177
        faPtr = (TkFontAttributes *) 0x0
        fmPtr = (TkFontMetrics *) 0xbb861418
        family = 0xbbaacaa0 "\030\211\020"
        familyPtr = (char **) 0xbfbfde54
        weight = 135129280
        slant = -1148907700
        spacing = -1077944728
        i = 38
        size = 3.7114161395201585e-314
        set = (FcFontSet *) 0x81a8280
        charset = (FcCharSet *) 0x8243d08
        result = FcResultNoMatch
        ftFont = (XftFont *) 0x0
#1  0xbbbac52d in TkpGetFontFromAttributes (tkFontPtr=0x0, tkwin=0x8246500, faPtr=0xbfbfdee0)
    at /home/emiliano/tcl_sources/tk/unix/../unix/tkUnixRFont.c:360
        pattern = (XftPattern *) 0x824f720
        weight = 100
        slant = 0
        fontPtr = (UnixFtFont *) 0x0
#2  0xbbae313a in Tk_AllocFontFromObj (interp=0x804f800, tkwin=0x8246500, objPtr=0x8266900)
    at /home/emiliano/tcl_sources/tk/unix/../generic/tkFont.c:1188
        fa = {family = 0x82633d0 "Helvetica", size = 13, weight = 0, slant = 0, underline = 0, 
  overstrike = 0}
        dupObjPtr = (Tcl_Obj *) 0x82668e8
        fiPtr = (TkFontInfo *) 0x8052d80
        cacheHashPtr = (Tcl_HashEntry *) 0x80de8a0
        namedHashPtr = (Tcl_HashEntry *) 0x0
        fontPtr = (TkFont *) 0x0
        firstFontPtr = (TkFont *) 0x0
        oldFontPtr = (TkFont *) 0x0
        isNew = 1
        descent = 134745680
        nfPtr = (NamedFont *) 0xbfbfe018
#3  0xbbadae91 in DoObjConfig (interp=0x804f800, recordPtr=0x8246600 "", optionPtr=0x82478e8, 
    valuePtr=0x8266900, tkwin=0x8246500, savedOptionPtr=0x0)
    at /home/emiliano/tcl_sources/tk/unix/../generic/tkConfig.c:773
        newFont = (Tk_Font) 0x824f710
        slotPtrPtr = (Tcl_Obj **) 0x0
        oldPtr = (Tcl_Obj *) 0x0
        internalPtr = 0x8246648 ""
        oldInternalPtr = 0xbfbfdfc4 " ʪ»øß¿¿"
        internal = {optionPtr = 0xbb9c4e08, valuePtr = 0x824f710, 
  internalForm = -0.12451128560750613}
        specPtr = (const Tk_OptionSpec *) 0xbbbdada8
        nullOK = 0
#4  0xbbada91c in Tk_InitOptions (interp=0x804f800, recordPtr=0x8246600 "", optionTable=0x8247800, 
    tkwin=0x8246500) at /home/emiliano/tcl_sources/tk/unix/../generic/tkConfig.c:553
        tablePtr = (OptionTable *) 0x8247800
        optionPtr = (Option *) 0x82478e8
        count = 18
        value = 0x815c870 "Helvetica 13"
        valuePtr = (Tcl_Obj *) 0x8266900
        source = OPTION_DATABASE
#5  0xbbb117c1 in Tk_ListboxObjCmd (clientData=0x0, interp=0x804f800, objc=6, objv=0x80541c0)
    at /home/emiliano/tcl_sources/tk/unix/../generic/tkListbox.c:560
        listPtr = (Listbox *) 0x8246600
        tkwin = (Tk_Window) 0x8246500
        optionTables = (ListboxOptionTables *) 0x81a87f0
#6  0xbb9c8e6b in TclEvalObjvInternal (interp=0x804f800, objc=6, objv=0x80541c0, 
    command=0x816dd93 "listbox .lb -listvariable fuentes -yscrollcommand {.sb set}\nlabel .show -bg white -font $fuente -text [lindex $fuentes 0]\npack .sup .inf -expand 1 -fill both\npack propagate .inf 0\npack .sb -side right"..., length=60, flags=0)
    at /home/emiliano/tcl_sources/tcl/unix/../generic/tclBasic.c:3613
        cmdPtr = (Command *) 0x8090e40
        iPtr = (Interp *) 0x804f800
        newObjv = (Tcl_Obj **) 0x816ddcf
        i = -1146758808
        savedVarFramePtr = (CallFrame *) 0x0
        varFramePtr = (CallFrame *) 0x8051240
        code = 0
        traceCode = 0
        checkTraces = 1
        traced = 0
        savedNsPtr = (Namespace *) 0x0
        lookupNsPtr = (Namespace *) 0x0
        commandPtr = (Tcl_Obj *) 0x0
#7  0xbb9c9dd8 in TclEvalEx (interp=0x804f800, 
    script=0x816dc00 "tk_setPalette seashell\noption add *Listbox.background white\noption add *Listbox.selectBackground darkblue\noption add *Listbox.selectForeground white\noption add *borderWidth 1\noption add *font {Helveti"..., numBytes=871, flags=0, line=13)
    at /home/emiliano/tcl_sources/tcl/unix/../generic/tclBasic.c:4262
        wordLine = 13
        wordStart = 0x816ddc5 "{.sb set}\nlabel .show -bg white -font $fuente -text [lindex $fuentes 0]\npack .sup .inf -expand 1 -fill both\npack propagate .inf 0\npack .sb -side right -fill y -in .sup\npack .lb -side left -expand 1 -f"...
        objectsNeeded = 6
        numWords = 6
        iPtr = (Interp *) 0x804f800
        p = 0x816dd93 "listbox .lb -listvariable fuentes -yscrollcommand {.sb set}\nlabel .show -bg white -font $fuente -text [lindex $fuentes 0]\npack .sup .inf -expand 1 -fill both\npack propagate .inf 0\npack .sb -side right"...
        next = 0x816dd93 "listbox .lb -listvariable fuentes -yscrollcommand {.sb set}\nlabel .show -bg white -font $fuente -text [lindex $fuentes 0]\npack .sup .inf -expand 1 -fill both\npack propagate .inf 0\npack .sb -side right"...
        minObjs = 20
        objv = (Tcl_Obj **) 0x80541c0
        objvSpace = (Tcl_Obj **) 0x80541c0
        expand = (int *) 0x8054214
        lines = (int *) 0x8054268
        lineSpace = (int *) 0x8054268
        tokenPtr = (Tcl_Token *) 0x8054110
        commandLength = 0
        bytesLeft = 468
        expandRequested = 0
        code = 0
        savedVarFramePtr = (CallFrame *) 0x8051240
        allowExceptions = 0
        gotParse = 1
        i = 6
        objectsUsed = 6
        parsePtr = (Tcl_Parse *) 0x8054018
        eeFramePtr = (CmdFrame *) 0x8054194
        stackObjArray = (Tcl_Obj **) 0x80541c0
        expandStack = (int *) 0x8054214
        linesStack = (int *) 0x8054268
#8  0xbb9c9565 in Tcl_EvalEx (interp=0x804f800, 
    script=0x816dc00 "tk_setPalette seashell\noption add *Listbox.background white\noption add *Listbox.selectBackground darkblue\noption add *Listbox.selectForeground white\noption add *borderWidth 1\noption add *font {Helveti"..., numBytes=871, flags=0)
    at /home/emiliano/tcl_sources/tcl/unix/../generic/tclBasic.c:3965
No locals.
#9  0xbba46001 in Tcl_FSEvalFileEx (interp=0x804f800, pathPtr=0x805b018, encodingName=0x0)
    at /home/emiliano/tcl_sources/tcl/unix/../generic/tclIOUtil.c:1826
        result = 1
        length = 871
        statBuf = {st_dev = 0, st_mode = 33188, st_ino = 1633514, st_nlink = 1, st_uid = 1000, 
  st_gid = 100, st_rdev = 6762071, st_atimespec = {tv_sec = 1192127374, tv_nsec = 478794375}, 
  st_mtimespec = {tv_sec = 1158687047, tv_nsec = 89275000}, st_ctimespec = {tv_sec = 1158687047, 
    tv_nsec = 89275000}, st_birthtimespec = {tv_sec = 0, tv_nsec = 0}, st_size = 871, 
  st_blocks = 2, st_blksize = 8192, st_flags = 0, st_gen = 0, st_spare = {3243953126, 0}}
        oldScriptFile = (Tcl_Obj *) 0x0
        iPtr = (Interp *) 0x804f800
        string = 0x816dc00 "tk_setPalette seashell\noption add *Listbox.background white\noption add *Listbox.selectBackground darkblue\noption add *Listbox.selectForeground white\noption add *borderWidth 1\noption add *font {Helveti"...
        chan = (Tcl_Channel) 0x80bc820
        objPtr = (Tcl_Obj *) 0x80a8300
#10 0xbbaf1535 in Tk_MainEx (argc=-1, argv=0xbfbfe704, appInitProc=0x80489d7 <Tcl_AppInit>, 
    interp=0x804f800) at /home/emiliano/tcl_sources/tk/unix/../generic/tkMain.c:272
        path = (Tcl_Obj *) 0x805b018
        argvPtr = (Tcl_Obj *) 0x805e8d0
        encodingName = 0x0
        code = -1077942608
        nullStdin = 0
        inChannel = (Tcl_Channel) 0xbbbf5501
        outChannel = (Tcl_Channel) 0xbbbec200
        tsdPtr = (ThreadSpecificData *) 0x805c200
        appName = {string = 0xbfbfe56c "", length = 0, spaceAvl = 200, 
  staticSpace = "\000uentes.tcl\000½r¿»\004\204\004\bع7\004¨ì¿»´å¿¿\001\000\000\000p\020\006\b,\225ª»tr¿»\201)¼»´å¿¿\224\202½\001D³©»\000\000\000\000\200\020\006\b\000ľ»|ì¿»h\202\004\b\034\000\000\000\004\204\004\b&u¿»\004\204\004\bع7\004\000¾»\004æ¿¿\001\000\000\000\000\000\000\000 ʪ»Ät¿»\177\\\234»\000ø\004\bD³©\001\001\000\000\000@ÿª» \000\000\000\000ľ»|ì¿»t\234\004\b\000\000\000\000\230æ¿¿\206V¿»\005\000\000\000\000¾»8æ¿¿\001\000\000\000\000\000\000\000\000¾»"}
#11 0x080489c4 in main (argc=2, argv=0xbfbfe6fc)
    at /home/emiliano/tcl_sources/tk/unix/../unix/tkAppInit.c:68
No locals.
(gdb) 


This is the script: 


emiliano@maq033:~/tcl_sources$ cat fuentes.tcl 
tk_setPalette seashell
option add *Listbox.background white
option add *Listbox.selectBackground darkblue
option add *Listbox.selectForeground white
option add *borderWidth 1
option add *font {Helvetica 13}

set fuentes [lsort [font families]]
set fuente [font create -family [lindex $fuentes 0] -size 12]
frame .sup
frame .inf -width 300 -height 100
scrollbar .sb -orient vertical -command {.lb yview}
listbox .lb -listvariable fuentes -yscrollcommand {.sb set}
label .show -bg white -font $fuente -text [lindex $fuentes 0]
pack .sup .inf -expand 1 -fill both
pack propagate .inf 0
pack .sb -side right -fill y -in .sup
pack .lb -side left -expand 1 -fill both -in .sup
pack .show -expand 1 -fill both -in .inf
focus .lb

bind .lb <<ListboxSelect>> {
   set tmp [lindex $fuentes [.lb curselection]]
   font configure $fuente -family $tmp 
   .show configure -text $tmp
}