File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -743,8 +743,7 @@ FT2Font::~FT2Font()
743743{
744744 _VERBOSE (" FT2Font::~FT2Font" );
745745
746- if (image)
747- Py::_XDECREF (image);
746+ Py_XDECREF (image);
748747 FT_Done_Face ( face );
749748
750749 for (size_t i=0 ; i<glyphs.size (); i++) {
@@ -781,7 +780,7 @@ FT2Font::clear(const Py::Tuple & args) {
781780 _VERBOSE (" FT2Font::clear" );
782781 args.verify_length (0 );
783782
784- delete image;
783+ Py_XDECREF ( image) ;
785784 image = NULL ;
786785
787786 angle = 0.0 ;
@@ -1037,7 +1036,7 @@ FT2Font::get_glyph(const Py::Tuple & args){
10371036 if ( (size_t )num >= gms.size ())
10381037 throw Py::ValueError (" Glyph index out of range" );
10391038
1040- // todo: refcount?
1039+ Py_INCREF (gms[num]);
10411040 return Py::asObject (gms[num]);
10421041}
10431042
@@ -1667,8 +1666,11 @@ char FT2Font::get_image__doc__ [] =
16671666Py::Object
16681667FT2Font::get_image (const Py::Tuple &args) {
16691668 args.verify_length (0 );
1670- Py_INCREF (image);
1671- return Py::asObject (image);
1669+ if (image) {
1670+ Py_XINCREF (image);
1671+ return Py::asObject (image);
1672+ }
1673+ throw Py::RuntimeError (" You must call .set_text() before .get_image()" );
16721674}
16731675
16741676char FT2Font::attach_file__doc__ [] =
You can’t perform that action at this time.
0 commit comments