return tui_win_list[V];
}
-/* A map holding all the known window types, keyed by name. Note that
- this is heap-allocated and "leaked" at gdb exit. This avoids
- ordering issues with destroying elements in the map at shutdown.
- In particular, destroying this map can occur after Python has been
- shut down, causing crashes if any window destruction requires
- running Python code. */
+/* A map holding all the known window types, keyed by name. */
-static window_types_map *known_window_types;
+static window_types_map known_window_types;
/* See tui-layout.h. */
known_window_names_range
all_known_window_names ()
{
- auto begin = known_window_names_iterator (known_window_types->begin ());
- auto end = known_window_names_iterator (known_window_types->end ());
+ auto begin = known_window_names_iterator (known_window_types.begin ());
+ auto end = known_window_names_iterator (known_window_types.end ());
return known_window_names_range (begin, end);
}
if (name == window->name ())
return window;
- auto iter = known_window_types->find (name);
- if (iter == known_window_types->end ())
+ auto iter = known_window_types.find (name);
+ if (iter == known_window_types.end ())
error (_("Unknown window type \"%s\""), name.c_str ());
tui_win_info *result = iter->second (name.c_str ());
static void
initialize_known_windows ()
{
- known_window_types = new window_types_map;
-
- known_window_types->emplace (SRC_NAME,
+ known_window_types.emplace (SRC_NAME,
make_standard_window<SRC_WIN,
tui_source_window>);
- known_window_types->emplace (CMD_NAME,
+ known_window_types.emplace (CMD_NAME,
make_standard_window<CMD_WIN, tui_cmd_window>);
- known_window_types->emplace (DATA_NAME,
+ known_window_types.emplace (DATA_NAME,
make_standard_window<DATA_WIN,
tui_data_window>);
- known_window_types->emplace (DISASSEM_NAME,
+ known_window_types.emplace (DISASSEM_NAME,
make_standard_window<DISASSEM_WIN,
tui_disasm_window>);
- known_window_types->emplace (STATUS_NAME,
+ known_window_types.emplace (STATUS_NAME,
make_standard_window<STATUS_WIN,
tui_locator_window>);
}
this far then NAME must be a user defined window. Remove any existing
factory and replace it with this new version. */
- auto iter = known_window_types->find (name);
- if (iter != known_window_types->end ())
- known_window_types->erase (iter);
+ auto iter = known_window_types.find (name);
+ if (iter != known_window_types.end ())
+ known_window_types.erase (iter);
- known_window_types->emplace (std::move (name_copy),
+ known_window_types.emplace (std::move (name_copy),
std::move (factory));
}
static bool
validate_window_name (const std::string &name)
{
- auto iter = known_window_types->find (name);
- return iter != known_window_types->end ();
+ auto iter = known_window_types.find (name);
+ return iter != known_window_types.end ();
}
/* Implementation of the "tui new-layout" command. */