Commit e9ca0f8
authored
core: Acquire renderer state mutex before calling processLinks (ghostty-org#12463)
Holding the renderer state mutex is a documented precondition of
`processLinks`, but `mouseButtonCallback` previously called the function
without the mutex.
This creates a race with the I/O thread's `processOutput`, which can
prune scrollback pages while `processLinks` is reading them, resulting
in a use-after-free segfault. See
ghostty-org#12409 (Linux: crash
while selecting text).
https://github.com/ghostty-org/ghostty/blob/57b5e1e2507cd65ab8197d39baa4ce2505185510/src/Surface.zig#L4354-L4355
https://github.com/ghostty-org/ghostty/blob/57b5e1e2507cd65ab8197d39baa4ce2505185510/src/Surface.zig#L3822-L3824
995e4e3 (os: open) changed the body of `processLinks` to be
non-trivial and documented the precondition, but the lock was not held
at the call site.1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3821 | 3821 | | |
3822 | 3822 | | |
3823 | 3823 | | |
| 3824 | + | |
| 3825 | + | |
3824 | 3826 | | |
3825 | 3827 | | |
3826 | 3828 | | |
| |||
0 commit comments