Author: lewing
Date: 2007-10-04 00:48:43 -0400 (Thu, 04 Oct 2007)
New Revision: 86845

Modified:
   trunk/moon/src/font.cpp
   trunk/moon/src/text.cpp
Log:
2007-10-03  Larry Ewing  <[EMAIL PROTECTED]>

        * src/text.cpp:
        * src/font.cpp: add null checks to protect against corner cases.
        In particular make sure a path has non-null data before
appending it.



Modified: trunk/moon/src/font.cpp
===================================================================
--- trunk/moon/src/font.cpp     2007-10-04 03:45:43 UTC (rev 86844)
+++ trunk/moon/src/font.cpp     2007-10-04 04:48:43 UTC (rev 86845)
@@ -625,7 +625,10 @@
        cairo_save (cr);
        
        cairo_translate (cr, x, y);
-       cairo_append_path (cr, &glyph->path->cairo);
+
+       // cairo doesn't like appending paths with NULL data
+       if ((&glyph->path->cairo)->data)
+               cairo_append_path (cr, &glyph->path->cairo);
        
        cairo_restore (cr);
 }
@@ -1580,7 +1583,10 @@
                                        cairo_fill (cr);
                                }
                        } else {
-                               cairo_append_path (cr, segment->path);
+                               // it is an error to append a path with no data
+                               if (segment->path->data)
+                                       cairo_append_path (cr, segment->path);
+
                                x1 = x0 + segment->width;
                                cairo_fill (cr);
                        }

Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp     2007-10-04 03:45:43 UTC (rev 86844)
+++ trunk/moon/src/text.cpp     2007-10-04 04:48:43 UTC (rev 86845)
@@ -1434,7 +1434,7 @@
        double x0, y0;
        double y1;
        
-       if ((width == 0.0 && height == 0.0) || invalid)
+       if (font == NULL || (width == 0.0 && height == 0.0) || invalid)
                return;
        
        fill->SetupBrush (cr, this);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to