1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Free autocompleters on quit

This commit is contained in:
James Booth 2012-10-22 00:29:39 +01:00
parent 5353bb47d6
commit 3f8813bb1b
4 changed files with 17 additions and 6 deletions

View File

@ -367,25 +367,32 @@ cmd_init(void)
unsigned int i;
for (i = 0; i < ARRAY_SIZE(main_commands); i++) {
struct cmd_t *pcmd = main_commands+i;
p_autocomplete_add(commands_ac, (gchar *)pcmd->cmd);
p_autocomplete_add(help_ac, (gchar *)pcmd->cmd+1);
p_autocomplete_add(commands_ac, (gchar *)strdup(pcmd->cmd));
p_autocomplete_add(help_ac, (gchar *)strdup(pcmd->cmd+1));
}
for (i = 0; i < ARRAY_SIZE(setting_commands); i++) {
struct cmd_t *pcmd = setting_commands+i;
p_autocomplete_add(commands_ac, (gchar *)pcmd->cmd);
p_autocomplete_add(help_ac, (gchar *)pcmd->cmd+1);
p_autocomplete_add(commands_ac, (gchar *)strdup(pcmd->cmd));
p_autocomplete_add(help_ac, (gchar *)strdup(pcmd->cmd+1));
}
for (i = 0; i < ARRAY_SIZE(status_commands); i++) {
struct cmd_t *pcmd = status_commands+i;
p_autocomplete_add(commands_ac, (gchar *)pcmd->cmd);
p_autocomplete_add(help_ac, (gchar *)pcmd->cmd+1);
p_autocomplete_add(commands_ac, (gchar *)strdup(pcmd->cmd));
p_autocomplete_add(help_ac, (gchar *)strdup(pcmd->cmd+1));
}
history_init();
}
void
cmd_close(void)
{
p_autocomplete_clear(commands_ac);
p_autocomplete_clear(help_ac);
}
// Command autocompletion functions
char *

View File

@ -33,6 +33,7 @@ struct cmd_help_t {
};
void cmd_init(void);
void cmd_close(void);
char * cmd_complete(char *inp);
void cmd_reset_completer(void);
gboolean cmd_execute(const char * const command, const char * const inp);

View File

@ -117,6 +117,7 @@ prefs_load(void)
void
prefs_close(void)
{
p_autocomplete_clear(ac);
g_key_file_free(prefs);
}

View File

@ -308,8 +308,10 @@ _shutdown_init(void)
static void
_shutdown(void)
{
contact_list_clear();
gui_close();
chat_log_close();
prefs_close();
cmd_close();
log_close();
}