mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +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);
|
ProgramState *current_program_state = get_current_program_state (builder);
|
||||||
OpColor *op;
|
OpColor *op;
|
||||||
|
|
||||||
if (current_program_state->color &&
|
if (gdk_rgba_equal (color, ¤t_program_state->color))
|
||||||
gdk_rgba_equal (color, current_program_state->color))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_program_state->color = color;
|
current_program_state->color = *color;
|
||||||
|
|
||||||
op = ops_begin (builder, OP_CHANGE_COLOR);
|
op = ops_begin (builder, OP_CHANGE_COLOR);
|
||||||
op->rgba = color;
|
op->rgba = color;
|
||||||
@ -696,14 +695,13 @@ ops_set_border_color (RenderOpBuilder *builder,
|
|||||||
ProgramState *current_program_state = get_current_program_state (builder);
|
ProgramState *current_program_state = get_current_program_state (builder);
|
||||||
OpBorder *op;
|
OpBorder *op;
|
||||||
|
|
||||||
if (current_program_state->border.color &&
|
if (gdk_rgba_equal (color, ¤t_program_state->border.color))
|
||||||
gdk_rgba_equal (color, current_program_state->border.color))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_BORDER_COLOR);
|
op = op_buffer_add (&builder->render_ops, OP_CHANGE_BORDER_COLOR);
|
||||||
op->color = color;
|
op->color = color;
|
||||||
|
|
||||||
current_program_state->border.color = color;
|
current_program_state->border.color = *color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -112,14 +112,14 @@ typedef struct
|
|||||||
float opacity;
|
float opacity;
|
||||||
/* Per-program state */
|
/* Per-program state */
|
||||||
union {
|
union {
|
||||||
const GdkRGBA *color;
|
GdkRGBA color;
|
||||||
struct {
|
struct {
|
||||||
graphene_matrix_t matrix;
|
graphene_matrix_t matrix;
|
||||||
graphene_vec4_t offset;
|
graphene_vec4_t offset;
|
||||||
} color_matrix;
|
} color_matrix;
|
||||||
struct {
|
struct {
|
||||||
float widths[4];
|
float widths[4];
|
||||||
const GdkRGBA *color;
|
GdkRGBA color;
|
||||||
GskRoundedRect outline;
|
GskRoundedRect outline;
|
||||||
} border;
|
} border;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user