[gtk/wip/baedert/gl-rework: 19/41] gl renderer: Avoid an invalid read
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/gl-rework: 19/41] gl renderer: Avoid an invalid read
- Date: Fri, 20 Dec 2019 09:54:15 +0000 (UTC)
commit b4beea1ff2a7035391bd587b96200d3a3e57dbdd
Author: Timm Bäder <mail baedert org>
Date: Tue Dec 17 13:06:02 2019 +0100
gl renderer: Avoid an invalid read
We need to copy the color here, since the program state can live across
frame boundaries.
gsk/gl/gskglrenderops.c | 10 ++++------
gsk/gl/gskglrenderopsprivate.h | 4 ++--
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index c2df2f6b4c..27b7bb48ac 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -617,11 +617,10 @@ ops_set_color (RenderOpBuilder *builder,
ProgramState *current_program_state = get_current_program_state (builder);
OpColor *op;
- if (current_program_state->color &&
- gdk_rgba_equal (color, current_program_state->color))
+ if (gdk_rgba_equal (color, ¤t_program_state->color))
return;
- current_program_state->color = color;
+ current_program_state->color = *color;
op = ops_begin (builder, OP_CHANGE_COLOR);
op->rgba = color;
@@ -696,14 +695,13 @@ ops_set_border_color (RenderOpBuilder *builder,
ProgramState *current_program_state = get_current_program_state (builder);
OpBorder *op;
- if (current_program_state->border.color &&
- gdk_rgba_equal (color, current_program_state->border.color))
+ if (gdk_rgba_equal (color, ¤t_program_state->border.color))
return;
op = op_buffer_add (&builder->render_ops, OP_CHANGE_BORDER_COLOR);
op->color = color;
- current_program_state->border.color = color;
+ current_program_state->border.color = *color;
}
void
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index 81c567e831..216a457042 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -112,14 +112,14 @@ typedef struct
float opacity;
/* Per-program state */
union {
- const GdkRGBA *color;
+ GdkRGBA color;
struct {
graphene_matrix_t matrix;
graphene_vec4_t offset;
} color_matrix;
struct {
float widths[4];
- const GdkRGBA *color;
+ GdkRGBA color;
GskRoundedRect outline;
} border;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]