fix reported crash of TTY_PERM_INVENT segfaulting
Options processing can be early, even before ttyDisplay is allocated. If we find that TTY_PERM_INVENT initialization is happening too early, just set a marker (iflags.perm_invent_pending) to try again a bit later. The changes in win/share are just to be able to sucessfully reproduce the original issue on Windows. It was easily reproduced on Unix, just by building with TTY_PERM_INVENT in include/config.h and setting OPTIONS=perm_invent in config file.
This commit is contained in:
@@ -5384,7 +5384,11 @@ can_set_perm_invent(void)
|
||||
iflags.perminv_mode = InvOptOn;
|
||||
|
||||
#ifdef TTY_PERM_INVENT
|
||||
if (WINDOWPORT(tty) && !go.opt_initial) {
|
||||
if ((WINDOWPORT(tty)
|
||||
#ifdef WIN32
|
||||
|| WINDOWPORT(safestartup)
|
||||
#endif
|
||||
) && !go.opt_initial) {
|
||||
perm_invent_toggled(FALSE);
|
||||
/* perm_invent_toggled()
|
||||
-> sync_perminvent()
|
||||
@@ -5401,6 +5405,20 @@ can_set_perm_invent(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TTY_PERM_INVENT
|
||||
void
|
||||
check_perm_invent_again(void)
|
||||
{
|
||||
if (iflags.perm_invent_pending) {
|
||||
iflags.perm_invent = FALSE;
|
||||
if (can_set_perm_invent())
|
||||
iflags.perm_invent = TRUE;
|
||||
iflags.perm_invent_pending = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
staticfn int
|
||||
handler_menustyle(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user