Avoid race condition when handling a SIGWINCH signal

The control variable win_resized must be cleared before responding to
it.

Otherwise there is a small window where another SIGWINCH might occur in
between the handling of an earlier SIGWINCH and the clearing of
win_resized, at which point win_resized would be set (again) by the
signal handler.  Shortly thereafter we would clear win_resized even
though we only handled the earlier SIGWINCH but not the latest one.
This chain of events is all avoided if we clear win_resized first.

gdb/ChangeLog:

	* tui/tui-win.c (tui_async_resize_screen): Clear win_resized
	first before resizing the window.
	* tui.c (tui_enable): Likewise.
This commit is contained in:
Patrick Palka 2015-04-27 21:37:48 -04:00
parent 558e546967
commit 1e04046d0b
2 changed files with 2 additions and 2 deletions

View file

@ -858,10 +858,10 @@ tui_async_resize_screen (gdb_client_data arg)
}
else
{
tui_set_win_resized_to (FALSE);
tui_resize_all ();
tui_refresh_all_win ();
tui_update_gdb_sizes ();
tui_set_win_resized_to (FALSE);
tui_redisplay_readline ();
}
}

View file

@ -492,8 +492,8 @@ tui_enable (void)
window. */
if (tui_win_resized ())
{
tui_resize_all ();
tui_set_win_resized_to (FALSE);
tui_resize_all ();
}
if (deprecated_safe_get_selected_frame ())