[cairo] [PATCH 1/2] Don't return NULL to clients when getting image
Bryce Harrington
bryce at osg.samsung.com
Mon Sep 22 15:50:25 PDT 2014
Return an error surface instead.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=58061
Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
src/cairo-qt-surface.cpp | 2 +-
src/cairo-quartz-image-surface.c | 2 +-
src/win32/cairo-win32-surface.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/cairo-qt-surface.cpp b/src/cairo-qt-surface.cpp
index 8a91984..d1c7760 100644
--- a/src/cairo-qt-surface.cpp
+++ b/src/cairo-qt-surface.cpp
@@ -1688,7 +1688,7 @@ cairo_qt_surface_get_image (cairo_surface_t *surface)
cairo_qt_surface_t *qs = (cairo_qt_surface_t*) surface;
if (surface->type != CAIRO_SURFACE_TYPE_QT)
- return NULL;
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
return qs->image_equiv;
}
diff --git a/src/cairo-quartz-image-surface.c b/src/cairo-quartz-image-surface.c
index 2715abd..511b634 100644
--- a/src/cairo-quartz-image-surface.c
+++ b/src/cairo-quartz-image-surface.c
@@ -379,7 +379,7 @@ cairo_quartz_image_surface_get_image (cairo_surface_t *asurface)
cairo_quartz_image_surface_t *surface = (cairo_quartz_image_surface_t*) asurface;
if (asurface->type != CAIRO_SURFACE_TYPE_QUARTZ_IMAGE)
- return NULL;
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
return (cairo_surface_t*) surface->imageSurface;
}
diff --git a/src/win32/cairo-win32-surface.c b/src/win32/cairo-win32-surface.c
index 7cd46fc..f11cbd8 100644
--- a/src/win32/cairo-win32-surface.c
+++ b/src/win32/cairo-win32-surface.c
@@ -188,7 +188,7 @@ cairo_surface_t *
cairo_win32_surface_get_image (cairo_surface_t *surface)
{
if (surface->backend->type != CAIRO_SURFACE_TYPE_WIN32)
- return NULL;
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
GdiFlush();
return to_win32_display_surface(surface)->image;
--
1.7.9.5
More information about the cairo
mailing list