[cairo-commit] src/cairo-surface.c

Uli Schlachter psychon at kemper.freedesktop.org
Tue Sep 25 03:00:38 PDT 2012


 src/cairo-surface.c |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 9735d1d716262a0c4f0a77363ce8c7d6064fa7d6
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:58:18 2012 +0200

    mark_dirty: Check surface status
    
    This problem was introduced in commit "xlib: Implement SHM fallbacks and fast
    upload paths". Before, cairo_surface_mark_dirty() directly called
    cairo_surface_mark_dirty_rectangle() with special "magical arguments" and thus
    didn't need any checks on the surface status.
    
    Fixes: api-special-cases
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index cbb2cfe..c11e9e7 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1512,6 +1512,13 @@ cairo_surface_mark_dirty (cairo_surface_t *surface)
 {
     cairo_rectangle_int_t extents;
 
+    if (unlikely (surface->status))
+	return;
+    if (unlikely (surface->finished)) {
+	_cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+	return;
+    }
+
     _cairo_surface_get_extents (surface, &extents);
     cairo_surface_mark_dirty_rectangle (surface,
 					extents.x, extents.y,


More information about the cairo-commit mailing list