Revision: 3790
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3790&view=rev
Author:   mdboom
Date:     2007-09-05 08:47:35 -0700 (Wed, 05 Sep 2007)

Log Message:
-----------
Fix some recent reference counting bugs in ft2font.cpp (Thanks to Paul Kienzle).

Modified Paths:
--------------
    trunk/matplotlib/src/ft2font.cpp

Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp    2007-09-05 15:28:21 UTC (rev 3789)
+++ trunk/matplotlib/src/ft2font.cpp    2007-09-05 15:47:35 UTC (rev 3790)
@@ -743,8 +743,7 @@
 {
   _VERBOSE("FT2Font::~FT2Font");
 
-  if(image)
-    Py::_XDECREF(image);
+  Py_XDECREF(image);
   FT_Done_Face    ( face );
 
   for (size_t i=0; i<glyphs.size(); i++) {
@@ -781,7 +780,7 @@
   _VERBOSE("FT2Font::clear");
   args.verify_length(0);
 
-  delete image;
+  Py_XDECREF(image);
   image = NULL;
 
   angle = 0.0;
@@ -1037,7 +1036,7 @@
   if ( (size_t)num >= gms.size())
     throw Py::ValueError("Glyph index out of range");
 
-  //todo: refcount?
+  Py_INCREF(gms[num]);
   return Py::asObject(gms[num]);
 }
 
@@ -1667,8 +1666,11 @@
 Py::Object
 FT2Font::get_image (const Py::Tuple &args) {
   args.verify_length(0);
-  Py_INCREF(image);
-  return Py::asObject(image);
+  if (image) {
+    Py_XINCREF(image);
+    return Py::asObject(image);
+  } 
+  throw Py::RuntimeError("You must call .set_text() before .get_image()");
 }
 
 char FT2Font::attach_file__doc__ [] =


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to