Revision: 4984
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4984&view=rev
Author: mdboom
Date: 2008-02-20 06:11:59 -0800 (Wed, 20 Feb 2008)
Log Message:
-----------
Fix memory leak in Gtk backend.
Modified Paths:
--------------
trunk/matplotlib/src/_path.cpp
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp 2008-02-19 21:33:26 UTC (rev 4983)
+++ trunk/matplotlib/src/_path.cpp 2008-02-20 14:11:59 UTC (rev 4984)
@@ -1099,12 +1099,10 @@
polygon_array = (PyArrayObject*)PyArray_SimpleNew
(2, polygon_dims, PyArray_DOUBLE);
if (!polygon_array)
- {
throw Py::MemoryError("Error creating polygon array");
- }
double* polygon_data = (double*)PyArray_DATA(polygon_array);
memcpy(polygon_data, &polygon[0], polygon.size() * sizeof(double));
- polygons.append(Py::Object((PyObject*)polygon_array));
+ polygons.append(Py::Object((PyObject*)polygon_array, true));
}
Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args)
@@ -1133,6 +1131,8 @@
double x, y;
unsigned code;
+ polygon.reserve(path.total_vertices());
+
while ((code = curve.vertex(&x, &y)) != agg::path_cmd_stop)
{
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) {
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins