diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 7bfdadbe3db0..91dbb364fdd0 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -870,24 +870,28 @@ FT2Font::FT2Font(std::string facefile) : { std::ostringstream s; s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl; + ob_refcnt--; throw Py::RuntimeError(s.str()); } else if (error == FT_Err_Cannot_Open_Resource) { std::ostringstream s; s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl; + ob_refcnt--; throw Py::RuntimeError(s.str()); } else if (error == FT_Err_Invalid_File_Format) { std::ostringstream s; s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl; + ob_refcnt--; throw Py::RuntimeError(s.str()); } else if (error) { std::ostringstream s; s << "Could not open facefile " << facefile << "; freetype error code " << error << std::endl; + ob_refcnt--; throw Py::RuntimeError(s.str()); } @@ -904,6 +908,7 @@ FT2Font::FT2Font(std::string facefile) : { std::ostringstream s; s << "Could not set the fontsize for facefile " << facefile << std::endl; + ob_refcnt--; throw Py::RuntimeError(s.str()); }