Revision: 5140
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5140&view=rev
Author:   mdboom
Date:     2008-05-15 06:03:49 -0700 (Thu, 15 May 2008)

Log Message:
-----------
Fix Tk backend segfault.

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/src/_tkagg.cpp

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2008-05-14 17:28:26 UTC (rev 5139)
+++ trunk/matplotlib/CHANGELOG  2008-05-15 13:03:49 UTC (rev 5140)
@@ -1,3 +1,5 @@
+2008-05-15 Fix Tk backend segfault on some machines - MGD
+
 2008-05-14 Don't use stat on Windows (fixes font embedding problem) - MGD
 
 2008-05-09 Fix /singlequote (') in Postscript backend - MGD

Modified: trunk/matplotlib/src/_tkagg.cpp
===================================================================
--- trunk/matplotlib/src/_tkagg.cpp     2008-05-14 17:28:26 UTC (rev 5139)
+++ trunk/matplotlib/src/_tkagg.cpp     2008-05-15 13:03:49 UTC (rev 5140)
@@ -11,6 +11,7 @@
 
 #include <Python.h>
 #include <stdlib.h>
+#include <sstream>
 
 #include "agg_basics.h"
 #include "_backend_agg.h"
@@ -50,6 +51,7 @@
     agg::int8u *destbuffer;
     double l,b,r,t;
     int destx, desty, destwidth, destheight, deststride;
+    unsigned long tmp_ptr;
 
     long mode;
     long nval;
@@ -71,7 +73,10 @@
         return TCL_ERROR;
     }
     /* get array (or object that can be converted to array) pointer */
-    aggo = (PyObject*)atol(argv[2]);
+    std::stringstream agg_ptr_ss;
+    agg_ptr_ss.str(argv[2]);
+    agg_ptr_ss >> tmp_ptr;
+    aggo = (PyObject*)tmp_ptr;
     RendererAgg *aggRenderer = (RendererAgg *)aggo;
     int srcheight = (int)aggRenderer->get_height();
 
@@ -85,7 +90,10 @@
     }
 
     /* check for bbox/blitting */
-    bboxo = (PyObject*)atol(argv[4]);
+    std::stringstream bbox_ptr_ss;
+    bbox_ptr_ss.str(argv[4]);
+    bbox_ptr_ss >> tmp_ptr;
+    bboxo = (PyObject*)tmp_ptr;
     if (py_convert_bbox(bboxo, l, b, r, t)) {
       has_bbox = true;
 


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

Reply via email to