| Ticket UUID: | c069e1444c0290eb8348d265a3219e4a2ce84757 | |||
| Title: | Wayland branch: use after free of a toplevel destroyed before its first focus | |||
| Type: | Bug | Version: | wayland | |
| Submitter: | serhiy.storchaka | Created on: | 2026-10-14 17:30:04 | |
| Subsystem: | (unused) | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2026-10-22 17:22:38 | |
| Resolution: | Fixed | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-10-14 18:05:14 | |||
| Description: |
On the wayland branch ([d4ed20b447]), the ttk test suite crashes under headless sway (after labelframe.test): #0 TkWaylandGetGLFWwindow (winPtr=...) at wayland/tkWaylandInit.c:1888 #1 UpdateGeometryInfo (clientData=...) at wayland/tkWaylandWm.c:4025 #2 TimerHandlerEventProc () from libtcl9.1.so ... #5 Tk_UpdateObjCmd () While a toplevel has not yet been focused, UpdateGeometryInfo() reschedules itself every 17 ms with Tcl_CreateTimerHandler(). But TkWmDeadWindow() and the other places which cancel a pending update only call Tcl_CancelIdleCall(), so if the toplevel is destroyed before its first focus, the timer fires later with the freed TkWindow. The crash depends on what is in the freed memory, so it shows up only sometimes. The token of the timer should be kept in the WmInfo and the timer deleted wherever the idle call is cancelled. | |||
| User Comments: |
serhiy.storchaka added on 2026-10-14 18:05:02:
Thanks. The crash depends on what is in the freed memory, so it shows up only sometimes. Merged into wayland in [57603ad17d]. kevin_walzer added on 2026-10-14 17:54:14: I am not able to reproduce this crash, but your fix looks reasonable. Feel free to merge to wayland. serhiy.storchaka added on 2026-10-14 17:36:14: Proposed fix in branch wayland-geometry-timer, [3f86399d14], based on the current wayland: the token of the timer is kept in the WmInfo, and CancelGeometryUpdate() deletes the timer wherever the idle call was cancelled, including TkWmDeadWindow(). With it the ttk test suite runs to the end under headless sway; without it, it crashed after labelframe.test in both runs. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki