[gtk/ebassi/for-master] Blend nodes might have NULL top/bottom nodes
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/for-master] Blend nodes might have NULL top/bottom nodes
- Date: Thu, 26 Nov 2020 00:23:28 +0000 (UTC)
commit 247fc2e47190ed8cb69cc51a3589b1dc0037142c
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Nov 26 00:21:11 2020 +0000
Blend nodes might have NULL top/bottom nodes
We have code in place to handle a NULL node in the state when dealing
with blend nodes, but we don't always check for NULL, which leads to
warnings in the CSS Blend modes demo.
gtk/gtksnapshot.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index e3b3538c2f..40122f6338 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -1178,7 +1178,9 @@ gtk_snapshot_collect_blend_top (GtkSnapshot *snapshot,
GdkRGBA transparent = { 0, 0, 0, 0 };
top_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes);
- bottom_node = gsk_render_node_ref (state->data.blend.bottom_node);
+ bottom_node = state->data.blend.bottom_node != NULL
+ ? gsk_render_node_ref (state->data.blend.bottom_node)
+ : NULL;
g_assert (top_node != NULL || bottom_node != NULL);
@@ -1199,7 +1201,7 @@ gtk_snapshot_collect_blend_top (GtkSnapshot *snapshot,
static void
gtk_snapshot_clear_blend_top (GtkSnapshotState *state)
{
- gsk_render_node_unref (state->data.blend.bottom_node);
+ g_clear_pointer (&(state->data.blend.bottom_node), gsk_render_node_unref);
}
static GskRenderNode *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]