mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
Merge pull request #924 from mitchellh/disco-clear
font: fallback fonts need to deinit their unused deferred faces
This commit is contained in:
@ -459,23 +459,29 @@ pub fn indexForCodepoint(
|
|||||||
defer disco_it.deinit();
|
defer disco_it.deinit();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const face_ = disco_it.next() catch |err| {
|
var deferred_face = (disco_it.next() catch |err| {
|
||||||
log.warn("fallback search failed with error err={}", .{err});
|
log.warn("fallback search failed with error err={}", .{err});
|
||||||
break;
|
break;
|
||||||
};
|
}) orelse break;
|
||||||
const face: GroupFace = .{ .fallback_deferred = face_ orelse break };
|
|
||||||
|
|
||||||
// Discovery is supposed to only return faces that have our
|
// Discovery is supposed to only return faces that have our
|
||||||
// codepoint but we can't search presentation in discovery so
|
// codepoint but we can't search presentation in discovery so
|
||||||
// we have to check it here.
|
// we have to check it here.
|
||||||
if (!face.hasCodepoint(cp, p_mode)) continue;
|
const face: GroupFace = .{ .fallback_deferred = deferred_face };
|
||||||
|
if (!face.hasCodepoint(cp, p_mode)) {
|
||||||
|
deferred_face.deinit();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var buf: [256]u8 = undefined;
|
var buf: [256]u8 = undefined;
|
||||||
log.info("found codepoint 0x{x} in fallback face={s}", .{
|
log.info("found codepoint 0x{x} in fallback face={s}", .{
|
||||||
cp,
|
cp,
|
||||||
face_.?.name(&buf) catch "<error>",
|
deferred_face.name(&buf) catch "<error>",
|
||||||
});
|
});
|
||||||
return self.addFace(style, face) catch break :discover;
|
return self.addFace(style, face) catch {
|
||||||
|
deferred_face.deinit();
|
||||||
|
break :discover;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("no fallback face found for cp={x}", .{cp});
|
log.debug("no fallback face found for cp={x}", .{cp});
|
||||||
|
Reference in New Issue
Block a user