diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-01-25 15:46:58 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-08 11:18:33 +0000 |
commit | 1cf2399651ef3fe1350ad8276cf00d16ddeb9960 (patch) | |
tree | ef7670ef713ccdc3f2013d9477a0c4882032c5d7 /setup.com | |
parent | a53a265752ef4b911d175aea62e082e54e717497 (diff) | |
download | gdb-1cf2399651ef3fe1350ad8276cf00d16ddeb9960.zip gdb-1cf2399651ef3fe1350ad8276cf00d16ddeb9960.tar.gz gdb-1cf2399651ef3fe1350ad8276cf00d16ddeb9960.tar.bz2 |
gdb/tui: don't add windows to global list from tui_layout:window::apply
This commit was inspired by this mailing list patch:
https://sourceware.org/pipermail/gdb-patches/2021-January/174713.html
Currently, calling tui_layout_window::apply will add the window from
the layout object to the global tui_windows list.
Unfortunately, when the user runs the 'winheight' command, this calls
tui_adjust_window_height, which calls the tui_layout_base::adjust_size
function, which can then call tui_layout_base::apply. The consequence
of this is that when the user does 'winheight' duplicate copies of a
window can be added to the global tui_windows list.
The original patch fixed this by changing the apply function to only
update the global list some of the time.
This patch takes a different approach. The apply function no longer
updates the global tui_windows list. Instead a new virtual function
is added to tui_layout_base which is used to gather all the currently
applied windows into a vector. Finally tui_apply_current_layout is
updated to make use of this new function to update the tui_windows
list.
The benefits I see in this approach are, (a) the apply function now no
longer touches global state, this solves the immediate problem,
and (b) now that tui_windows is updated directly in the function
tui_apply_current_layout, we can drop the saved_tui_windows global.
gdb/ChangeLog:
* tui-layout.c (saved_tui_windows): Delete.
(tui_apply_current_layout): Don't make use of saved_tui_windows,
call new get_windows member function instead.
(tui_get_window_by_name): Check in tui_windows.
(tui_layout_window::apply): Don't add to tui_windows.
* tui-layout.h (tui_layout_base::get_windows): New member function.
(tui_layout_window::get_windows): Likewise.
(tui_layout_split::get_windows): Likewise.
gdb/testsuite/ChangeLog:
* gdb.tui/winheight.exp: Add more tests.
Diffstat (limited to 'setup.com')
0 files changed, 0 insertions, 0 deletions