Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84524eb

Browse files
committed
Reinstate the manual reference counting as discovered in #1054.
1 parent 797940f commit 84524eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ft2font.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,24 +852,28 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
852852
{
853853
std::ostringstream s;
854854
s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl;
855+
ob_refcnt--;
855856
throw Py::RuntimeError(s.str());
856857
}
857858
else if (error == FT_Err_Cannot_Open_Resource)
858859
{
859860
std::ostringstream s;
860861
s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl;
862+
ob_refcnt--;
861863
throw Py::RuntimeError(s.str());
862864
}
863865
else if (error == FT_Err_Invalid_File_Format)
864866
{
865867
std::ostringstream s;
866868
s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl;
869+
ob_refcnt--;
867870
throw Py::RuntimeError(s.str());
868871
}
869872
else if (error)
870873
{
871874
std::ostringstream s;
872875
s << "Could not open facefile " << facefile << "; freetype error code " << error << std::endl;
876+
ob_refcnt--;
873877
throw Py::RuntimeError(s.str());
874878
}
875879

@@ -887,6 +891,7 @@ FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds)
887891
{
888892
std::ostringstream s;
889893
s << "Could not set the fontsize for facefile " << facefile << std::endl;
894+
ob_refcnt--;
890895
throw Py::RuntimeError(s.str());
891896
}
892897

0 commit comments

Comments
 (0)