[cairo] [PATCH] Add a couple of checks to handle error surface situations.

Alejandro Garcia Castro alex at igalia.com
Thu Aug 30 02:20:36 PDT 2012


From: "Alejandro G. Castro" <alex at igalia.com>

After 0bfd2ac api-special-cases test was crashing because in
some error situations we do not have a backend.
---
 src/cairo-image-surface-inline.h |    2 +-
 src/cairo-surface.c              |    3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/cairo-image-surface-inline.h b/src/cairo-image-surface-inline.h
index 4959107..f6bed71 100644
--- a/src/cairo-image-surface-inline.h
+++ b/src/cairo-image-surface-inline.h
@@ -73,7 +73,7 @@ _cairo_image_surface_is_clone (cairo_image_surface_t *image)
 static inline cairo_bool_t
 _cairo_surface_is_image (const cairo_surface_t *surface)
 {
-    return surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
+    return surface->backend == &_cairo_image_surface_backend;
 }
 
 /**
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 465c7c0..554f2bd 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1539,6 +1539,9 @@ cairo_surface_mark_dirty (cairo_surface_t *surface)
 {
     cairo_rectangle_int_t extents;
 
+    if (unlikely (surface->status))
+	return;
+
     _cairo_surface_get_extents (surface, &extents);
     cairo_surface_mark_dirty_rectangle (surface,
 					extents.x, extents.y,
-- 
1.7.10.4



More information about the cairo mailing list