mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22: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:
14
putty.h
14
putty.h
@ -1299,8 +1299,14 @@ struct TermWinVtable {
|
||||
|
||||
/* Query the front end for any OS-local overrides to the default
|
||||
* colours stored in Conf. The front end should set any it cares
|
||||
* about by calling term_palette_override. */
|
||||
void (*palette_get_overrides)(TermWin *);
|
||||
* about by calling term_palette_override.
|
||||
*
|
||||
* The Terminal object is passed in as a parameter, because this
|
||||
* can be called as a callback from term_init(). So the TermWin
|
||||
* itself won't yet have been told where to find its Terminal
|
||||
* object, because that doesn't happen until term_init
|
||||
* returns. */
|
||||
void (*palette_get_overrides)(TermWin *, Terminal *);
|
||||
};
|
||||
|
||||
static inline bool win_setup_draw_ctx(TermWin *win)
|
||||
@ -1354,8 +1360,8 @@ static inline void win_set_zorder(TermWin *win, bool top)
|
||||
static inline void win_palette_set(
|
||||
TermWin *win, unsigned start, unsigned ncolours, const rgb *colours)
|
||||
{ win->vt->palette_set(win, start, ncolours, colours); }
|
||||
static inline void win_palette_get_overrides(TermWin *win)
|
||||
{ win->vt->palette_get_overrides(win); }
|
||||
static inline void win_palette_get_overrides(TermWin *win, Terminal *term)
|
||||
{ win->vt->palette_get_overrides(win, term); }
|
||||
|
||||
/*
|
||||
* Global functions not specific to a connection instance.
|
||||
|
Reference in New Issue
Block a user