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?pull/9240/merge
parent
580262c96f
commit
973cfd98a5
|
|
@ -172,11 +172,7 @@ pub fn init(surface: *Surface) !Inspector {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.key_events = key_buf,
|
.key_events = key_buf,
|
||||||
.vt_events = vt_events,
|
.vt_events = vt_events,
|
||||||
.vt_stream = stream: {
|
.vt_stream = .initAlloc(surface.alloc, vt_handler),
|
||||||
var s: inspector.termio.Stream = .init(vt_handler);
|
|
||||||
s.parser.osc_parser.alloc = surface.alloc;
|
|
||||||
break :stream s;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,7 +190,6 @@ pub fn deinit(self: *Inspector) void {
|
||||||
while (it.next()) |v| v.deinit(self.surface.alloc);
|
while (it.next()) |v| v.deinit(self.surface.alloc);
|
||||||
self.vt_events.deinit(self.surface.alloc);
|
self.vt_events.deinit(self.surface.alloc);
|
||||||
|
|
||||||
self.vt_stream.handler.deinit();
|
|
||||||
self.vt_stream.deinit();
|
self.vt_stream.deinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue