fix(font/freetype): mark glyph bitmap as owned if modifying

This caused a malloc fault due to a double free when deiniting the face
if we didn't do this, which makes sense- making it possible to actually
load bitmap fonts revealed this bug which was sitting dormant the whole
time before that ever since I refactored the freetype rasterization.
pull/8512/head
Qwerasd 2025-09-03 21:33:38 -06:00
parent 5c1d87fda6
commit aeae54072c
1 changed files with 6 additions and 0 deletions

View File

@ -594,6 +594,12 @@ pub const Face = struct {
freetype.c.FT_PIXEL_MODE_GRAY,
=> {},
else => {
// Make sure the slot owns its bitmap,
// since we'll be modifying it here.
if (freetype.c.FT_GlyphSlot_Own_Bitmap(glyph) != 0) {
return error.BitmapHandlingError;
}
var converted: freetype.c.FT_Bitmap = undefined;
freetype.c.FT_Bitmap_Init(&converted);
if (freetype.c.FT_Bitmap_Convert(