Hasty Briefsbeta

Bilingual

We Rewrote the Ghostty GTK Application

9 hours ago
  • Ghostty's GTK application was rewritten to fully embrace GObject type system from Zig, leading to better feature richness, stability, and maintainability.
  • The rewrite solved memory management bugs by wrapping Zig-owned Config structures in reference-counted GObjects, simplifying configuration reload and GUI updates.
  • Valgrind was used extensively to verify every change, identifying memory leaks and undefined access, especially at C API boundaries.
  • Zig's own codebase had only one leak and one undefined access, both at C API boundaries, highlighting Zig's memory safety features.
  • The rewrite enabled use of modern GTK UI technologies like Blueprint, allowing easier addition of GUI features such as titlebar tabs and animated bell border.
  • Valgrind caught subtle issues like improper GObject WeakRef clearing, which could cause rare crashes, emphasizing the need for tooling when crossing C APIs.
  • The new GTK application is now the default build from source and will be included in Ghostty 1.2 release.