From b5ce84214f26c49877dcb8181bcf3091f1f574bb Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 10 Jun 2010 13:48:31 +0000 Subject: [PATCH] [3011582] stix_fonts_demo.py assert error 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 --- src/ft2font.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 7bdf62e0cd7a..37821faa08d0 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -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()); } @@ -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()); } @@ -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));