1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Make TermWin's palette_get_overrides() take a Terminal *.

Less than 12 hours after 0.75 went out of the door, a user pointed out
that enabling the 'Use system colours' config option causes an
immediate NULL-dereference crash. The reason is because a chain of
calls from term_init() ends up calling back to the Windows
implementation of the palette_get_overrides() method, which responds
by trying to call functions on the static variable 'term' in window.c,
which won't be initialised until term_init() has returned.

Simple fix: palette_get_overrides() is now given a pointer to the
Terminal that it should be updating, because it can't find it out any
other way.
This commit is contained in:
Simon Tatham
2021-05-08 18:13:06 +01:00
parent a55aac71e4
commit 571fa3388d
5 changed files with 15 additions and 9 deletions

View File

@ -257,7 +257,7 @@ static void wintw_set_maximised(TermWin *, bool maximised);
static void wintw_move(TermWin *, int x, int y);
static void wintw_set_zorder(TermWin *, bool top);
static void wintw_palette_set(TermWin *, unsigned, unsigned, const rgb *);
static void wintw_palette_get_overrides(TermWin *);
static void wintw_palette_get_overrides(TermWin *, Terminal *);
static const TermWinVtable windows_termwin_vt = {
.setup_draw_ctx = wintw_setup_draw_ctx,
@ -1130,7 +1130,7 @@ static inline rgb rgb_from_colorref(COLORREF cr)
return toret;
}
static void wintw_palette_get_overrides(TermWin *tw)
static void wintw_palette_get_overrides(TermWin *tw, Terminal *term)
{
if (conf_get_bool(conf, CONF_system_colour)) {
rgb rgb;