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

Alejandro Garcia Castro <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
From: "Alejandro G. Castro" <[email protected]>

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

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.