Skip to content

Commit

Permalink
Merge pull request #2635 from mdboom/font-crash
Browse files Browse the repository at this point in the history
BUG : Don't clear glyphs if face never made
  • Loading branch information
tacaswell committed Aug 26, 2014
2 parents 9a42b8d + ec2212e commit 9d648fc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ft2font.cpp
Expand Up @@ -850,6 +850,7 @@ PYCXX_NOARGS_METHOD_DECL(FT2Font, get_path)

FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
Py::PythonClass<FT2Font>(self, args, kwds),
face(NULL),
image()
{
FT_Open_Args open_args;
Expand Down Expand Up @@ -979,11 +980,13 @@ FT2Font::~FT2Font()
{
_VERBOSE("FT2Font::~FT2Font");

FT_Done_Face(face);
if (face) {
FT_Done_Face(face);

for (size_t i = 0; i < glyphs.size(); i++)
{
FT_Done_Glyph(glyphs[i]);
for (size_t i = 0; i < glyphs.size(); i++)
{
FT_Done_Glyph(glyphs[i]);
}
}

if (stream.descriptor.pointer != NULL) {
Expand Down

0 comments on commit 9d648fc

Please sign in to comment.