Delete all commands on shutdown

Originally committed to SVN as r5473.
This commit is contained in:
Thomas Goyne 2011-07-15 17:36:17 +00:00
parent a8a30d6ac1
commit faecc3304d
3 changed files with 11 additions and 0 deletions

View file

@ -107,4 +107,11 @@ namespace cmd {
init_tool();
init_video();
}
void clear() {
for (std::map<std::string, Command*>::iterator it = cmd_map.begin(); it != cmd_map.end(); ++it) {
delete it->second;
}
cmd_map.clear();
}
}

View file

@ -152,4 +152,7 @@ namespace cmd {
/// Retrieve a Command object.
/// @param Command object.
Command* get(std::string const& name);
/// Unregister all commands
void clear();
} // namespace cmd

View file

@ -334,6 +334,7 @@ int AegisubApp::OnExit() {
delete config::mru;
delete agi::hotkey::hotkey;
delete config::path;
cmd::clear();
#ifdef WITH_AUTOMATION
delete global_scripts;