gl renderer: Avoid an invalid read

We need to copy the color here, since the program state can live across
frame boundaries.
This commit is contained in:
Timm Bäder 2019-12-17 13:06:02 +01:00
parent 2079c898e7
commit 73f2167fe4
2 changed files with 6 additions and 8 deletions

View File

@ -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, &current_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, &current_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

View File

@ -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;
};