Skip to content

Commit

Permalink
Merge pull request #4160 from cgohlke/patch-1
Browse files Browse the repository at this point in the history
Fix segfault: do not destroy glyph while its bitmap is used
  • Loading branch information
radarhere committed Nov 2, 2019
2 parents 64e1fee + a2225ae commit b0eb5e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,6 @@ font_render(FontObject* self, PyObject* args)

bitmap = bitmap_glyph->bitmap;
left = bitmap_glyph->left;

FT_Done_Glyph(glyph);
} else {
bitmap = glyph_slot->bitmap;
left = glyph_slot->bitmap_left;
Expand Down Expand Up @@ -953,6 +951,9 @@ font_render(FontObject* self, PyObject* args)
}
x += glyph_info[i].x_advance;
y -= glyph_info[i].y_advance;
if (stroker != NULL) {
FT_Done_Glyph(glyph);
}
}

FT_Stroker_Done(stroker);
Expand Down

0 comments on commit b0eb5e1

Please sign in to comment.