mirror-ghostty/src
Nikolay Bryskin 0b6d91e531
apprt/gtk: reuse one audio-bell MediaFile per surface to fix thread leak
Each audio bell called gtk.MediaFile.newForFilename, which spins up a
full GStreamer pipeline. The GTK4 GStreamer backend's GL sink starts
gstglcontext/gldisplay-event threads that are never joined on teardown,
so allocating a MediaFile per ring leaked a pipeline and ~4 threads on
every bell. A long-running instance accumulated 705 threads over ~4h of
normal use.

Cache one MediaFile per surface (priv.bell_media), rebuilt only when
bell-audio-path changes and unref'd on dispose. Each bell now replays
the same pipeline via seek(0)+play() instead of creating a new one. The
notify::ended -> unref handler is removed: it was what discarded (and
leaked) a pipeline per ring. seek(0) is required so an ended stream
plays again (#8957).

Verified on a real instance: GStreamer's global element counter reached
only oggdemux4 over an hour of use (one pipeline per bell-ringing
surface, reused) and thread count stayed flat, versus per-bell growth
before.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 23:43:01 +03:00
..
apprt apprt/gtk: reuse one audio-bell MediaFile per surface to fix thread leak 2026-05-25 23:43:01 +03:00
benchmark benchmark: isolate parser hot loop from code-layout shifts 2026-04-23 21:36:39 -07:00
build build: gate lib-vt xcframework on emit-xcframework with xcodebuild detection 2026-04-24 13:21:43 -07:00
cli cli: fix readEntries leak and double-free 2026-05-25 11:49:01 -04:00
config libghostty: selection word/line/output/all helpers 2026-05-24 13:42:20 -07:00
crash Zig 0.15: zig build test macOS 2025-10-03 07:10:43 -07:00
datastruct fix datastruct/SplitTree not calculating the correct new split ratio when resizing a split 2026-05-05 18:00:04 +02:00
extra cli: add +explain-config 2026-03-15 20:58:43 -04:00
font font: add Windows font discovery backend (#12386) 2026-04-23 10:45:50 -07:00
input Apply suggestions from code review 2026-05-05 09:47:06 +02:00
inspector terminal: make stream processing infallible 2026-03-13 13:56:14 -07:00
lib build: refactor checkGhosttyHEnum to use @hasDecl instead of nested inline for 2026-03-24 20:12:57 +01:00
os deal with large outputs from xdg-open/rundll32/open 2026-05-24 20:35:39 -05:00
renderer renderer: skip updateFrame when surface is not visible 2026-05-20 22:50:03 -04:00
shell-integration elvish: remove community maintenance note 2026-05-25 11:56:37 -04:00
simd pkg/highway: vendor and modify to remain all libc usage 2026-04-23 20:28:43 -07:00
stb Fix typos 2025-10-03 18:52:26 +02:00
synthetic benchmark: add AGENTS, improve UTF-8 synthetic data 2026-04-15 08:28:36 -07:00
terminal libghostty: expose per-cell selection state 2026-05-24 20:24:16 -07:00
terminfo fix: update Se terminfo entry to reset cursor to configured default 2026-04-26 22:31:01 -05:00
termio address review: add unit tests for Windows execCommand paths 2026-04-23 23:08:58 +09:00
unicode Merge remote-tracking branch 'upstream/main' into grapheme-width-changes 2026-01-27 09:44:55 -05:00
App.zig config: use Config to check key binding instead of App 2026-04-24 18:26:56 +02:00
Command.zig Command: let CreateProcessW resolve the program via PATH 2026-04-23 14:40:13 +09:00
Surface.zig core: guard surface left-click pins with screen generations 2026-05-23 14:45:13 -07:00
apprt.zig Remove unused imports 2025-11-27 13:37:53 -08:00
build_config.zig Remove unused imports 2025-11-27 13:37:53 -08:00
cli.zig cli: make the action parser (+foo) generic and reusable 2025-07-09 15:06:24 -07:00
config.zig feat: add middle-click action configuration 2026-04-27 01:27:22 +10:00
fastmem.zig perf: replace `std.debug.assert` with inlined version 2025-11-17 12:13:56 -07:00
file_type.zig util: introduce helper for detecting file types 2025-06-25 16:27:23 -04:00
global.zig logging: document GHOSTTY_LOG and make it more flexible 2025-12-15 11:54:36 -08:00
helpgen.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
input.zig input: extract mouse encoding to a pure, testable file 2026-03-15 15:37:54 -07:00
lib_vt.zig libghostty: selection formatting 2026-05-24 14:01:35 -07:00
main.zig remove src/bench 2025-07-09 15:06:24 -07:00
main_bench.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_build_data.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
main_c.zig address review: collapse DllMain into a single struct 2026-04-23 02:17:04 +09:00
main_gen.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_ghostty.zig tripwire: a module for injecting failures to test errdefer 2026-01-21 09:39:02 -08:00
main_wasm.zig
math.zig
pty.c core: simplify pty.c macro usage 2026-03-20 10:37:42 -05:00
pty.zig core: address getProcessInfo feedback 2026-03-19 22:01:16 -05:00
quirks.zig quirks: remove type signature for inlineAssert 2025-12-08 13:19:16 +08:00
renderer.zig testing: use std.Build.TranslateC instead of @cImport 2026-02-27 10:13:03 -06:00
surface_mouse.zig terminal: consolidate mouse types into mouse.zig 2026-03-15 15:48:36 -07:00
termio.zig search thread needs to take an allocated needle 2025-11-26 08:50:04 -08:00
tripwire.zig tripwire: change backing store from ArrayHashMap to EnumMap 2026-01-21 15:30:49 -08:00