[gtk+] gsk: Check for NULL in calls to gsk_cairo_node_get_surface()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gsk: Check for NULL in calls to gsk_cairo_node_get_surface()
- Date: Tue, 20 Dec 2016 17:13:17 +0000 (UTC)
commit 3ef03c8bc0bed418406418127061ffc489aa938e
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 15 10:08:46 2016 +0100
gsk: Check for NULL in calls to gsk_cairo_node_get_surface()
That function does actually sometimes return NULL and is documented to
do so, so handle that case in the renderers (by omitting the node).
gsk/gskglrenderer.c | 3 +++
gsk/gskvulkanrenderpass.c | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index 1c09244..09a63ed 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -713,6 +713,9 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self,
cairo_surface_t *surface = gsk_cairo_node_get_surface (node);
int gl_min_filter = GL_NEAREST, gl_mag_filter = GL_NEAREST;
+ if (surface == NULL)
+ return;
+
get_gl_scaling_filters (node, &gl_min_filter, &gl_mag_filter);
/* Upload the Cairo surface to a GL texture */
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index a2d66c8..81912dd 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -100,9 +100,12 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
break;
case GSK_CAIRO_NODE:
- op.type = GSK_VULKAN_OP_SURFACE;
- op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
- g_array_append_val (self->render_ops, op);
+ if (gsk_cairo_node_get_surface (node) != NULL)
+ {
+ op.type = GSK_VULKAN_OP_SURFACE;
+ op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_BLIT);
+ g_array_append_val (self->render_ops, op);
+ }
break;
case GSK_TEXTURE_NODE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]