Revision: 4620
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4620&view=rev
Author:   mdboom
Date:     2007-12-05 08:35:26 -0800 (Wed, 05 Dec 2007)

Log Message:
-----------
Fix reference leak in draw_text_image.

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

Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp       2007-12-05 16:28:05 UTC (rev 
4619)
+++ trunk/matplotlib/src/_backend_agg.cpp       2007-12-05 16:35:26 UTC (rev 
4620)
@@ -2140,8 +2140,8 @@
   const unsigned char* buffer = NULL;
   int width, height;
   Py::Object image_obj = args[0];
+  PyArrayObject* image_array = NULL;
   if (PyArray_Check(image_obj.ptr())) {
-    PyArrayObject* image_array = NULL;
     image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(), 
PyArray_UBYTE, 2, 2);
     if (!image_array)
       throw Py::ValueError("First argument to draw_text_image must be a 
FT2Font.Image object or a Nx2 uint8 numpy array.");
@@ -2164,6 +2164,8 @@
   }
   catch (Py::TypeError) {
     //x,y out of range; todo issue warning?
+    if (image_array)
+      Py_XDECREF(image_array);
     return Py::Object();
   }
 
@@ -2209,6 +2211,8 @@
   theRasterizer->add_path(rect2);
   agg::render_scanlines(*theRasterizer, *slineP8, ri);
 
+  if (image_array)
+    Py_XDECREF(image_array);
 
   return Py::Object();
 }


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

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to