+2019-06-25 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-layout.c (make_source_or_disasm_window): Always use
+ init_and_make_win for EXEC_INFO_WIN.
+ * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: No
+ longer inline.
+ (struct tui_win_info) <~tui_win_info>: Inline.
+ (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
+ Don't declare.
+ * tui/tui-data.c (source_win, disasm_win): Remove globals.
+ (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
+ Remove.
+ (tui_initialize_static_data): Update.
+ (~tui_gen_win_info): Handle more cleanup here.
+ (~tui_source_window_base): Delete "execution_info".
+ (~tui_win_info): Move code to ~tui_gen_win_info; remove.
+
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (make_command_window): Don't set
static enum tui_layout_type current_layout = UNDEFINED_LAYOUT;
static int term_height, term_width;
static struct tui_gen_win_info _locator (LOCATOR_WIN);
-static struct tui_gen_win_info source_win (EXEC_INFO_WIN);
-static struct tui_gen_win_info disasm_win (EXEC_INFO_WIN);
static std::vector<tui_source_window_base *> source_windows;
static struct tui_win_info *win_with_focus = NULL;
static struct tui_layout_def layout_def = {
display_regs = false;
}
-/* Accessor for the source execution info ptr. */
-struct tui_gen_win_info *
-tui_source_exec_info_win_ptr (void)
-{
- return &source_win;
-}
-
-
-/* Accessor for the disassem execution info ptr. */
-struct tui_gen_win_info *
-tui_disassem_exec_info_win_ptr (void)
-{
- return &disasm_win;
-}
-
-
/* Accessor for the locator win info. Answers a pointer to the static
locator win info struct. */
struct tui_gen_win_info *
void
tui_initialize_static_data (void)
{
- tui_init_generic_part (tui_source_exec_info_win_ptr ());
- tui_init_generic_part (tui_disassem_exec_info_win_ptr ());
tui_init_generic_part (tui_locator_win_info_ptr ());
}
return index_start;
}
-tui_source_window_base::~tui_source_window_base ()
+tui_gen_win_info::~tui_gen_win_info ()
{
- xfree (fullname);
- struct tui_gen_win_info *generic_win = execution_info;
- if (generic_win != NULL)
+ if (handle != NULL)
{
- tui_delete_win (generic_win->handle);
- generic_win->handle = NULL;
- tui_free_win_content (generic_win);
+ tui_delete_win (handle);
+ handle = NULL;
+ tui_free_win_content (this);
}
+ xfree (title);
+}
+
+tui_source_window_base::~tui_source_window_base ()
+{
+ xfree (fullname);
+ delete execution_info;
}
tui_data_window::~tui_data_window ()
}
}
-tui_win_info::~tui_win_info ()
-{
- if (handle != NULL)
- {
- tui_delete_win (handle);
- handle = NULL;
- tui_free_win_content (this);
- }
- if (title)
- xfree (title);
-}
-
-
void
tui_free_all_source_wins_content ()
{
{
}
- virtual ~tui_gen_win_info ()
- {
- }
+ virtual ~tui_gen_win_info ();
/* Call to refresh this window. */
virtual void refresh_window ();
public:
- ~tui_win_info () override;
+ ~tui_win_info () override
+ {
+ }
/* Clear the pertinent detail in the window. */
virtual void clear_detail () = 0;
extern int tui_term_width (void);
extern void tui_set_term_width_to (int);
extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
-extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void);
-extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void);
extern std::vector<tui_source_window_base *> &tui_source_windows ();
extern void tui_clear_source_windows (void);
extern void tui_clear_source_windows_detail (void);
make_source_or_disasm_window (enum tui_win_type type,
int height, int origin_y)
{
- struct tui_gen_win_info *execution_info = NULL;
-
- /* Create the exeuction info window. */
- if (type == SRC_WIN)
- execution_info = tui_source_exec_info_win_ptr ();
- else
- execution_info = tui_disassem_exec_info_win_ptr ();
- execution_info
- = ((struct tui_gen_win_info *)
- init_and_make_win (execution_info,
- EXEC_INFO_WIN,
- height,
- 3,
- 0,
- origin_y,
- DONT_BOX_WINDOW));
+ struct tui_gen_win_info *execution_info
+ = init_and_make_win (nullptr,
+ EXEC_INFO_WIN,
+ height,
+ 3,
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
/* Now create the source window. */
struct tui_source_window_base *result