Skip to content

Commit

Permalink
[3011582] stix_fonts_demo.py assert error
Browse files Browse the repository at this point in the history
When matplotlib is compiled without -DNDEBUG, we get this error on one of the example:

$ python stix_fonts_demo.py
python2.6: CXX/cxx_extensions.cxx:1320: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

svn path=/trunk/matplotlib/; revision=8405
  • Loading branch information
mdboom committed Jun 10, 2010
1 parent 97b98e3 commit b5ce842
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ft2font.cpp
Expand Up @@ -686,25 +686,28 @@ FT2Font::FT2Font(std::string facefile) :

int error = FT_New_Face( _ft2Library, facefile.c_str(), 0, &face );


if (error == FT_Err_Unknown_File_Format ) {
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());
}

Expand All @@ -720,6 +723,7 @@ FT2Font::FT2Font(std::string facefile) :
if (error) {
std::ostringstream s;
s << "Could not set the fontsize for facefile " << facefile << std::endl;
ob_refcnt--;
throw Py::RuntimeError(s.str());
}

Expand All @@ -739,7 +743,6 @@ FT2Font::FT2Font(std::string facefile) :
if ( style_name == NULL )
style_name = "UNAVAILABLE";


setattr("postscript_name", Py::String(ps_name));
setattr("num_faces", Py::Int(face->num_faces));
setattr("family_name", Py::String(family_name));
Expand Down

0 comments on commit b5ce842

Please sign in to comment.