Revision: 5211
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5211&view=rev
Author:   mdboom
Date:     2008-05-21 06:06:51 -0700 (Wed, 21 May 2008)

Log Message:
-----------
Backport TkAgg segfault fix.

Modified Paths:
--------------
    branches/v0_91_maint/CHANGELOG
    branches/v0_91_maint/src/_tkagg.cpp

Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG      2008-05-21 13:03:36 UTC (rev 5210)
+++ branches/v0_91_maint/CHANGELOG      2008-05-21 13:06:51 UTC (rev 5211)
@@ -1,3 +1,5 @@
+2008-05-21 Fix segfault in TkAgg backend - MGD
+
 2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
 
 2008-05-19 Fix crash when Windows can not access the registry to

Modified: branches/v0_91_maint/src/_tkagg.cpp
===================================================================
--- branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:03:36 UTC (rev 5210)
+++ branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:06:51 UTC (rev 5211)
@@ -50,6 +50,7 @@
     agg::int8u *destbuffer;
     double l,b,r,t;
     int destx, desty, destwidth, destheight, deststride;
+    unsigned long aggl, bboxl;
 
     long mode;
     long nval;
@@ -71,7 +72,11 @@
         return TCL_ERROR;
     }
     /* get array (or object that can be converted to array) pointer */
-    aggo = (PyObject*)atol(argv[2]);
+    if (sscanf (argv[2],"%lu",&aggl) != 1) {
+        Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+        return TCL_ERROR;
+    }
+    aggo = (PyObject*)aggl;
     RendererAgg *aggRenderer = (RendererAgg *)aggo;
     int srcheight = (int)aggRenderer->get_height();
 
@@ -85,7 +90,11 @@
     }
 
     /* check for bbox/blitting */
-    bboxo = (PyObject*)atol(argv[4]);
+    if (sscanf(argv[4], "%lu", &bboxl) != 1) {
+      Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+      return TCL_ERROR;
+    }
+    bboxo = (PyObject*)bboxl;
     if (bboxo != Py_None) {
       bbox = (Bbox*)bboxo;
       l = bbox->ll_api()->x_api()->val();


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
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to