Tk Source Code

View Ticket
Login
Ticket UUID: a80e5ff97ede2b0cdc68a2f1b9ebba64cae4df8
Title: Core dump Tk_GetFontFromObj called with non-existent font in different X screens!
Type: Bug Version: 8.6.3, 8.6.4
Submitter: [email protected] Created on: 2017-05-16 12:13:00
Subsystem: 44. Generic Fonts Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2025-11-05 23:13:06
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2025-11-05 23:13:06
Description:
Setup: one X display with more than one screen. Can be emulated with the following command:

Xvfb :1 -screen 0 800x600x24+32 -screen 1 800x600x24+32 &

Running the script below in wish:

env DISPLAY=:1 ../rel/bin/wish

foreach s {0 1} {
    set screen :1.$s;
    set t [::toplevel .t$s -screen $screen]
    set mm [::ttk::label $t.mm];
    pack $mm;
}

causes wish to abort:

Tk_GetFontFromObj called with non-existent font!
Abort (core dumped)
User Comments: jan.nijtmans added on 2025-11-05 23:13:06:

1 warning during Tk compilation:
     Tk/generic/ttk/ttkCache.c: In function 'InitCacheWindow':
     Tk/generic/ttk/ttkCache.c:256:64: warning: unused parameter 'tkwin' [-Wunused-parameter]
     static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin)

Looking at this, instead of a separate 'tkwin' parameter, the one in the cache ('cache->tkwin') is used. The logical question is then: shouldn't this be done in more places? For example like: [ed67b8e0980fd5af|this]?


jan.nijtmans added on 2025-11-02 21:41:16:

Credit corrected (Thanks, @chrstphrchvz) and merged to all branches


chrstphrchvz added on 2025-11-01 18:40:11:

Jan, thanks for merging. Could the changes file please credit werner ? I am only a patch tester/committer in this case. Thanks


jan.nijtmans added on 2025-11-01 14:29:15:

[401a5f8f7e48200c|merged] to 8.6 now.


chrstphrchvz added on 2025-10-22 00:46:01:

Please consider branch bug-a80e5ff9 for merging. In hopes of getting this issue finally fixed, I have separated out Christian Werner's fix for this issue from the bug-c23f79ef96 branch.


fvogel added on 2017-08-12 16:58:46:

I concur.

I have run into this same issue and diagnosed the same cause when I was working on [c95d4691ff].

See also this discussion on Tcl Core list, that I started when working on the above mentioned ticket.

All this got eventually stalled (help welcome!).


[email protected] added on 2017-05-16 13:19:27:

Same observation with different displays:

Xvfb :1 &
Xvfb :2 &
Then:
% toplevel .t1 -screen :1;
.t1
% toplevel .t2 -screen :2;
.t2
% ttk::label .t1.l -text sometext;
.t1.l
% ttk::label .t2.l -text sometext;
Tk_GetFontFromObj called with non-existent font!
The issue seems pervasive in Ttk, but seems not to affect classic Tk widgets. We observed the issue not only with ttk::label but also with ttk::scrollbar. Nevertheless, it seems not to be specific to those widgets, but that it has to do with the font and border cache: if - when looking for a font in the cache - it finds some, then determines none of them are valid (belong to the other screen) and proceeds to abort. It never gets to add the font for the second screen to the cache. The same issue affects 3d borders (try creating ::ttk::scrollbars in different screens).