From 002f15c27779e154856fdf281360385f4d3be671 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 6 Jul 2019 15:52:13 -0600 Subject: Remove tui_alloc_source_buffer There is no longer any need for tui_alloc_source_buffer. The two callers of this function immediately change the contents of the window, undoing the work done by this function. This required adding a move constructor to tui_source_element -- a mildly surprising find, but without this, resizing the vector will cause crashes. This issue was masked earlier because tui_alloc_source_buffer handled this. Note that a patch for this bug was submitted here: https://sourceware.org/ml/gdb-patches/2019-08/msg00094.html That patch is better, IMO, but the author as yet hasn't responded to a request for a ChangeLog entry. gdb/ChangeLog 2019-08-15 Tom Tromey * tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare. (struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move constructor. * tui/tui-winsource.c (tui_alloc_source_buffer): Remove. * tui/tui-source.c (tui_set_source_content): Update. * tui/tui-disasm.c (tui_set_disassem_content): Update. --- gdb/tui/tui-winsource.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gdb/tui/tui-winsource.h') diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 237c4da..bff2560 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -69,6 +69,17 @@ struct tui_source_element xfree (line); } + DISABLE_COPY_AND_ASSIGN (tui_source_element); + + tui_source_element (tui_source_element &&other) + : line (other.line), + line_or_addr (other.line_or_addr), + is_exec_point (other.is_exec_point), + break_mode (other.break_mode) + { + other.line = nullptr; + } + char *line = nullptr; struct tui_line_or_address line_or_addr; bool is_exec_point = false; @@ -173,9 +184,6 @@ extern void tui_update_source_windows_with_line (struct symtab *, extern void tui_clear_source_content (struct tui_source_window_base *); extern void tui_erase_source_content (struct tui_source_window_base *); -extern void tui_alloc_source_buffer (struct tui_source_window_base *); - - /* Constant definitions. */ #define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */ -- cgit v1.1