From: <md...@us...> - 2008-02-01 18:40:03
|
Revision: 4926 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4926&view=rev Author: mdboom Date: 2008-02-01 10:39:59 -0800 (Fri, 01 Feb 2008) Log Message: ----------- Merged revisions 4921-4925 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r4922 | mdboom | 2008-02-01 13:02:14 -0500 (Fri, 01 Feb 2008) | 3 lines Backing out Glyph object leak fix, since it causes segfaults with PDF backend. Will look into it further. ........ r4924 | mdboom | 2008-02-01 13:03:52 -0500 (Fri, 01 Feb 2008) | 2 lines Oops in last commit. ........ r4925 | mdboom | 2008-02-01 13:36:38 -0500 (Fri, 01 Feb 2008) | 2 lines Hopefully fixing the Glyph memory leak properly now. ........ Modified Paths: -------------- trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/src/ft2font.h Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-4920 + /branches/v0_91_maint:1-4925 Modified: trunk/matplotlib/src/ft2font.cpp =================================================================== --- trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:36:38 UTC (rev 4925) +++ trunk/matplotlib/src/ft2font.cpp 2008-02-01 18:39:59 UTC (rev 4926) @@ -749,10 +749,6 @@ for (size_t i=0; i<glyphs.size(); i++) { FT_Done_Glyph( glyphs[i] ); } - - for (size_t i=0; i<gms.size(); i++) { - Py_DECREF(gms[i]); - } } int @@ -792,13 +788,8 @@ FT_Done_Glyph( glyphs[i] ); } - for (size_t i=0; i<gms.size(); i++) { - Py_DECREF(gms[i]); - } + glyphs.clear(); - glyphs.resize(0); - gms.resize(0); - return Py::Object(); } @@ -1020,26 +1011,6 @@ return xys; } - -char FT2Font::get_glyph__doc__[] = -"get_glyph(num)\n" -"\n" -"Return the glyph object with num num\n" -; -Py::Object -FT2Font::get_glyph(const Py::Tuple & args){ - _VERBOSE("FT2Font::get_glyph"); - - args.verify_length(1); - int num = Py::Int(args[0]); - - if ( (size_t)num >= gms.size()) - throw Py::ValueError("Glyph index out of range"); - - Py_INCREF(gms[num]); - return Py::asObject(gms[num]); -} - char FT2Font::get_num_glyphs__doc__[] = "get_num_glyphs()\n" "\n" @@ -1093,9 +1064,7 @@ size_t num = glyphs.size(); //the index into the glyphs list glyphs.push_back(thisGlyph); Glyph* gm = new Glyph(face, thisGlyph, num); - gms.push_back(gm); - Py_INCREF(gm); - return Py::asObject( gm); + return Py::asObject(gm); } char FT2Font::get_width_height__doc__[] = @@ -1763,8 +1732,6 @@ add_varargs_method("get_xys", &FT2Font::get_xys, FT2Font::get_xys__doc__); - add_varargs_method("get_glyph", &FT2Font::get_glyph, - FT2Font::get_glyph__doc__); add_varargs_method("get_num_glyphs", &FT2Font::get_num_glyphs, FT2Font::get_num_glyphs__doc__); add_keyword_method("load_char", &FT2Font::load_char, Modified: trunk/matplotlib/src/ft2font.h =================================================================== --- trunk/matplotlib/src/ft2font.h 2008-02-01 18:36:38 UTC (rev 4925) +++ trunk/matplotlib/src/ft2font.h 2008-02-01 18:39:59 UTC (rev 4926) @@ -30,11 +30,11 @@ void draw_bitmap(FT_Bitmap* bitmap, FT_Int x, FT_Int y); void write_bitmap(const char* filename) const; - void draw_rect(unsigned long x0, unsigned long y0, + void draw_rect(unsigned long x0, unsigned long y0, unsigned long x1, unsigned long y1); - void draw_rect_filled(unsigned long x0, unsigned long y0, + void draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1, unsigned long y1); - + unsigned int get_width() const { return _width; }; unsigned int get_height() const { return _height; }; const unsigned char *const get_buffer() const { return _buffer; }; @@ -94,7 +94,6 @@ Py::Object set_size(const Py::Tuple & args); Py::Object set_charmap(const Py::Tuple & args); Py::Object set_text(const Py::Tuple & args, const Py::Dict & kwargs); - Py::Object get_glyph(const Py::Tuple & args); Py::Object get_kerning(const Py::Tuple & args); Py::Object get_num_glyphs(const Py::Tuple & args); Py::Object load_char(const Py::Tuple & args, const Py::Dict & kws); @@ -124,7 +123,6 @@ FT_Error error; std::vector<FT_Glyph> glyphs; std::vector<FT_Vector> pos; - std::vector<Glyph*> gms; double angle; double ptsize; double dpi; @@ -168,16 +166,16 @@ Glyph::init_type(); FT2Font::init_type(); - add_varargs_method("FT2Font", &ft2font_module::new_ft2font, + add_varargs_method("FT2Font", &ft2font_module::new_ft2font, "FT2Font"); - add_varargs_method("FT2Image", &ft2font_module::new_ft2image, + add_varargs_method("FT2Image", &ft2font_module::new_ft2image, "FT2Image"); initialize( "The ft2font module" ); } - - ~ft2font_module(); + + ~ft2font_module(); //static FT_Library ft2Library; - + private: Py::Object new_ft2font (const Py::Tuple &args); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |