Revision: 4715
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4715&view=rev
Author:   mdboom
Date:     2007-12-12 11:15:46 -0800 (Wed, 12 Dec 2007)

Log Message:
-----------
Merged revisions 4707-4714 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib

........
  r4707 | mdboom | 2007-12-12 09:52:01 -0500 (Wed, 12 Dec 2007) | 2 lines
  
  Support fontconfig syntax in Text constructor.
........
  r4713 | mdboom | 2007-12-12 14:07:03 -0500 (Wed, 12 Dec 2007) | 2 lines
  
  Fix reference-counting leak when saving an Agg Png to a file-like object.
........

Modified Paths:
--------------
    branches/transforms/src/_backend_agg.cpp

Property Changed:
----------------
    branches/transforms/


Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/matplotlib:1-4706
   + /trunk/matplotlib:1-4714

Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp    2007-12-12 19:11:44 UTC (rev 
4714)
+++ branches/transforms/src/_backend_agg.cpp    2007-12-12 19:15:46 UTC (rev 
4715)
@@ -1289,17 +1289,21 @@
 static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t 
length) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write");
-  PyObject_CallFunction(write_method, "s#", data, length);
-
-  // MGDTODO: Check NULL on failure
+  PyObject* result = NULL;
+  if (write_method)
+    result = PyObject_CallFunction(write_method, "s#", data, length);
+  Py_XDECREF(write_method);
+  Py_XDECREF(result);
 }
 
 static void flush_png_data(png_structp png_ptr) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush");
-  if (flush_method) {
-    PyObject_CallFunction(flush_method, "");
-  }
+  PyObject* result = NULL;
+  if (flush_method)
+    result = PyObject_CallFunction(flush_method, "");
+  Py_XDECREF(flush_method);
+  Py_XDECREF(result);
 }
 
 // this code is heavily adapted from the paint license, which is in
@@ -1322,8 +1326,11 @@
   }
   else {
     PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write");
-    if (!(write_method && PyCallable_Check(write_method)))
+    if (!(write_method && PyCallable_Check(write_method))) {
+      Py_XDECREF(write_method);
       throw Py::TypeError("Object does not appear to be a path or a Python 
file-like object");
+    }
+    Py_XDECREF(write_method);
   }
 
   png_bytep *row_pointers = NULL;


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

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to