mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
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:
parent
2079c898e7
commit
73f2167fe4
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user