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

Skip to content

Commit ca678a4

Browse files
committed
Reinstate the manual reference counting as discovered in #1054.
1 parent cbb11da commit ca678a4

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
@@ -870,24 +870,28 @@ FT2Font::FT2Font(std::string facefile) :
870870
{
871871
std::ostringstream s;
872872
s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl;
873+
ob_refcnt--;
873874
throw Py::RuntimeError(s.str());
874875
}
875876
else if (error == FT_Err_Cannot_Open_Resource)
876877
{
877878
std::ostringstream s;
878879
s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl;
880+
ob_refcnt--;
879881
throw Py::RuntimeError(s.str());
880882
}
881883
else if (error == FT_Err_Invalid_File_Format)
882884
{
883885
std::ostringstream s;
884886
s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl;
887+
ob_refcnt--;
885888
throw Py::RuntimeError(s.str());
886889
}
887890
else if (error)
888891
{
889892
std::ostringstream s;
890893
s << "Could not open facefile " << facefile << "; freetype error code " << error << std::endl;
894+
ob_refcnt--;
891895
throw Py::RuntimeError(s.str());
892896
}
893897

@@ -904,6 +908,7 @@ FT2Font::FT2Font(std::string facefile) :
904908
{
905909
std::ostringstream s;
906910
s << "Could not set the fontsize for facefile " << facefile << std::endl;
911+
ob_refcnt--;
907912
throw Py::RuntimeError(s.str());
908913
}
909914

0 commit comments

Comments
 (0)