Skip to content

Commit 9d648fc

Browse files
committed
Merge pull request #2635 from mdboom/font-crash
BUG : Don't clear glyphs if face never made
2 parents 9a42b8d + ec2212e commit 9d648fc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ft2font.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ PYCXX_NOARGS_METHOD_DECL(FT2Font, get_path)
850850

851851
FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) :
852852
Py::PythonClass<FT2Font>(self, args, kwds),
853+
face(NULL),
853854
image()
854855
{
855856
FT_Open_Args open_args;
@@ -979,11 +980,13 @@ FT2Font::~FT2Font()
979980
{
980981
_VERBOSE("FT2Font::~FT2Font");
981982

982-
FT_Done_Face(face);
983+
if (face) {
984+
FT_Done_Face(face);
983985

984-
for (size_t i = 0; i < glyphs.size(); i++)
985-
{
986-
FT_Done_Glyph(glyphs[i]);
986+
for (size_t i = 0; i < glyphs.size(); i++)
987+
{
988+
FT_Done_Glyph(glyphs[i]);
989+
}
987990
}
988991

989992
if (stream.descriptor.pointer != NULL) {

0 commit comments

Comments
 (0)