Skip to content

Commit b5ce842

Browse files
committed
[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
1 parent 97b98e3 commit b5ce842

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ft2font.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,25 +686,28 @@ FT2Font::FT2Font(std::string facefile) :
686686

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

689-
690689
if (error == FT_Err_Unknown_File_Format ) {
691690
std::ostringstream s;
692691
s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl;
692+
ob_refcnt--;
693693
throw Py::RuntimeError(s.str());
694694
}
695695
else if (error == FT_Err_Cannot_Open_Resource) {
696696
std::ostringstream s;
697697
s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl;
698+
ob_refcnt--;
698699
throw Py::RuntimeError(s.str());
699700
}
700701
else if (error == FT_Err_Invalid_File_Format) {
701702
std::ostringstream s;
702703
s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl;
704+
ob_refcnt--;
703705
throw Py::RuntimeError(s.str());
704706
}
705707
else if (error) {
706708
std::ostringstream s;
707709
s << "Could not open facefile " << facefile << "; freetype error code " << error<< std::endl;
710+
ob_refcnt--;
708711
throw Py::RuntimeError(s.str());
709712
}
710713

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

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

742-
743746
setattr("postscript_name", Py::String(ps_name));
744747
setattr("num_faces", Py::Int(face->num_faces));
745748
setattr("family_name", Py::String(family_name));

0 commit comments

Comments
 (0)