Tk Source Code

View Ticket
Login
2026-11-10
17:26 • Ticket [09ee8c51] broken build: undefined reference XRenderQueryExtension status still Open with 3 other changes artifact: c0114d03 user: serhiy.storchaka
17:25
Fix [09ee8c51fe]: static build failed with undefined reference to XRenderQueryExtension. tkUnixEvent.c calls it since [b298b92ba7] was fixed, but -lXrender was not added to the Xft libraries. closed check-in: ad54674e user: serhiy.storchaka tags: xft-link-xrender-86
17:25
Fix [09ee8c51fe]: static build failed with undefined reference to XRenderQueryExtension. tkUnixEvent.c calls it since [b298b92ba7] was fixed, but -lXrender was not added to the Xft libraries. closed check-in: 30924535 user: serhiy.storchaka tags: xft-link-xrender
16:31 • Closed ticket [b298b92b]: Possible Tk regression when loading into threads plus 7 other changes artifact: af1c6202 user: nemethi
15:06
Fix for [b298b92ba7]: Possible Tk regression when loading into threads check-in: 9ef9af85 user: csaba tags: core-8-6-branch
15:01
Fix for [b298b92ba7]: Possible Tk regression when loading into threads check-in: d497451e user: csaba tags: core-9-0-branch
14:48
Fix for [b298b92ba7]: Possible Tk regression when loading into threads check-in: fa8a84bb user: csaba tags: trunk, main
2026-10-23
20:52 • Ticket [b298b92b] Possible Tk regression when loading into threads status still Open with 4 other changes artifact: e77c8bfa user: serhiy.storchaka
20:48
Fix [b298b92ba7]: when Tk was loaded into one thread after another on X11, a later thread died with a random X error. Xft's close-display hook frees glyphs through RENDER after RENDER's own hook has run, which registers RENDER again for the dying display, and a new display at the same address inherits the stale extension codes. Initialize RENDER in TkpOpenDisplay() before Xft, so that its hook runs last. closed check-in: 423012d7 user: serhiy.storchaka tags: x11-render-before-xft
2026-09-24
13:26 • Ticket [97a7ddac] X11 accessibility (ATK) is not thread-safe: crash when Tk is used in several threads status still Open with 3 other changes artifact: 909b7fbc user: serhiy.storchaka
2025-02-25
15:16 • Ticket [b298b92b] Possible Tk regression when loading into threads status still Open with 3 other changes artifact: 8bbb7add user: anonymous
15:06 • Ticket [b298b92b]: 3 changes artifact: daf342bf user: anonymous
14:57 • Ticket [b298b92b]: 4 changes artifact: 77c0b6d8 user: anonymous
14:55 • New ticket [b298b92b]. artifact: 184de54c user: anonymous

Ticket UUID: b298b92ba77684aa08f11c3e676f3db0837ec0b4
Title: Possible Tk regression when loading into threads
Type: Bug Version: 8.6.18, 9.0.5, 9.1.0
Submitter: anonymous Created on: 2025-02-25 14:55:52
Subsystem: (unused) Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-11-10 16:31:27
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-11-10 16:31:27
Description:
Interpreter exits execution running the following script under Tcl/Tk 9.0.1, but runs fine in 8.6.9-14 (Linux x64).


package require Thread

for {set c 1} {$c < 10000} {incr c} {
	set t1 [thread::create {package require Tk; thread::wait}]
	puts "$c $t1"
	after 100
	thread::release  $t1
}
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-11-10 16:31:27:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [fa8a84bb], [d497451e], and [9ef9af85].


serhiy.storchaka added on 2026-10-23 20:52:22:

This is not a regression: it happens in all versions, 8.6.9 included, once each thread creates a widget with a font. The script in the report passes in 8.6 and 9.1 only because no font is used there.

When a display is closed, the close hook of Xft frees its cached glyphs through RENDER after the close hook of RENDER has already run. That registers RENDER again for the dying display, and a new display opened later at the same address inherits the stale extension codes, so its RENDER requests go out with wrong opcodes and the X server replies with BadRequest or BadLength.

Fixed on branch x11-render-before-xft ([423012d795]): TkpOpenDisplay() initializes RENDER before Xft, so that the RENDER hook runs last. With it, 40 threads in a row, each creating labels, run without errors; without it, every run fails within a few threads.


anonymous added on 2025-02-25 15:06:09:
I've tested thread pools with the same result when a thread is released and then recreated. If I use a fixed pool size where min=max, then there is no issue.

It appears to have something to do with the thread id being reused and then Tk being loaded into this thread.

anonymous (claiming to be stever) added on 2025-02-25 14:57:27:
Submitted by stever (Steve Redler IV)