Revision: 8454
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8454&view=rev
Author:   mdboom
Date:     2010-06-22 16:00:55 +0000 (Tue, 22 Jun 2010)

Log Message:
-----------
Debian Bug#585442: python-matplotlib: crashes when calling axis() after imshow()
This allows the C++ exception raised when Agg rendering complexity is exceeded 
to percolate up correctly to a Python exception, rather than crashing the 
interpreter.

Modified Paths:
--------------
    trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h

Modified: trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h
===================================================================
--- trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h    2010-06-21 
21:41:19 UTC (rev 8453)
+++ trunk/matplotlib/agg24/include/agg_rasterizer_cells_aa.h    2010-06-22 
16:00:55 UTC (rev 8454)
@@ -29,16 +29,15 @@
 #ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED
 #define AGG_RASTERIZER_CELLS_AA_INCLUDED
 
+#include "CXX/Exception.hxx"
 #include <exception>
 #include <string.h>
 #include <math.h>
 #include "agg_math.h"
 #include "agg_array.h"
 
-
 namespace agg
 {
-
     //-----------------------------------------------------rasterizer_cells_aa
     // An internal class that implements the main rasterization algorithm.
     // Used in the rasterizer. Should not be used direcly.
@@ -180,6 +179,11 @@
     template<class Cell>
     AGG_INLINE void rasterizer_cells_aa<Cell>::add_curr_cell()
     {
+        static Py::Exception e(
+            Py::OverflowError(
+                "Agg rendering complexity exceeded. Consider downsampling or 
decimating your data."));
+
+
         if(m_curr_cell.area | m_curr_cell.cover)
         {
             if((m_num_cells & cell_block_mask) == 0)
@@ -187,8 +191,7 @@
                 if(m_num_blocks >= cell_block_limit) {
                     /* If this exception is thrown too often, one can
                        increase cell_block_limit */
-                    throw "Agg rendering complexity exceeded. "
-                        "Consider downsampling or decimating your data.";
+                    throw e;
                 }
                 allocate_block();
             }


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

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to