From 973cfd98a5636e40898865597afaf0600ddfbeff Mon Sep 17 00:00:00 2001 From: Daniel Wennberg Date: Sat, 25 Oct 2025 18:10:59 -0700 Subject: [PATCH] Update Inspector to the new Stream/VTHandler APIs (#9350) Fixes a double-free bug when closing the inspector. Not sure if there's a good way to add a test to check that allocation and deallocation are sound here? To instantiate an Inspector you need a Surface, which in turn requires an entire App/apprt. Doesn't look like the repo has any tests with that kind of scope at the moment? --- src/inspector/Inspector.zig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/inspector/Inspector.zig b/src/inspector/Inspector.zig index 49b05bd7f..92da5a362 100644 --- a/src/inspector/Inspector.zig +++ b/src/inspector/Inspector.zig @@ -172,11 +172,7 @@ pub fn init(surface: *Surface) !Inspector { .surface = surface, .key_events = key_buf, .vt_events = vt_events, - .vt_stream = stream: { - var s: inspector.termio.Stream = .init(vt_handler); - s.parser.osc_parser.alloc = surface.alloc; - break :stream s; - }, + .vt_stream = .initAlloc(surface.alloc, vt_handler), }; } @@ -194,7 +190,6 @@ pub fn deinit(self: *Inspector) void { while (it.next()) |v| v.deinit(self.surface.alloc); self.vt_events.deinit(self.surface.alloc); - self.vt_stream.handler.deinit(); self.vt_stream.deinit(); } }