mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-16 08:21:20 -04:00
fix segmenation fault in theme initialization
- initializes theme with conf->colors instead of NULL - ensures conf->initial_color_theme is not out of range
This commit is contained in:
parent
72d9a13c0c
commit
e8dcfe8a3f
2 changed files with 8 additions and 4 deletions
8
config.c
8
config.c
|
|
@ -1107,8 +1107,12 @@ parse_section_main(struct context *ctx)
|
||||||
sizeof(conf->initial_color_theme) == sizeof(int),
|
sizeof(conf->initial_color_theme) == sizeof(int),
|
||||||
"enum is not 32-bit");
|
"enum is not 32-bit");
|
||||||
|
|
||||||
return value_to_enum(ctx, (const char*[]){"1", "2", NULL},
|
int initial_color_theme = conf->initial_color_theme;
|
||||||
(int *)&conf->initial_color_theme);
|
bool status = value_to_enum(ctx, (const char*[]){"1", "2", NULL},
|
||||||
|
(int *)&initial_color_theme);
|
||||||
|
if(initial_color_theme != -1)
|
||||||
|
conf->initial_color_theme = initial_color_theme;
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1266,7 +1266,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
||||||
? wayl_do_linear_blending(wayl, conf) ? SHM_BITS_16 : SHM_BITS_8
|
? wayl_do_linear_blending(wayl, conf) ? SHM_BITS_16 : SHM_BITS_8
|
||||||
: conf->tweak.surface_bit_depth;
|
: conf->tweak.surface_bit_depth;
|
||||||
|
|
||||||
const struct color_theme *theme = NULL;
|
const struct color_theme *theme = &conf->colors;
|
||||||
switch (conf->initial_color_theme) {
|
switch (conf->initial_color_theme) {
|
||||||
case COLOR_THEME1: theme = &conf->colors; break;
|
case COLOR_THEME1: theme = &conf->colors; break;
|
||||||
case COLOR_THEME2: theme = &conf->colors2; break;
|
case COLOR_THEME2: theme = &conf->colors2; break;
|
||||||
|
|
@ -2169,7 +2169,7 @@ term_reset(struct terminal *term, bool hard)
|
||||||
if (!hard)
|
if (!hard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const struct color_theme *theme = NULL;
|
const struct color_theme *theme = &term->conf->colors;
|
||||||
|
|
||||||
switch (term->conf->initial_color_theme) {
|
switch (term->conf->initial_color_theme) {
|
||||||
case COLOR_THEME1: theme = &term->conf->colors; break;
|
case COLOR_THEME1: theme = &term->conf->colors; break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue