1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Free plugin autocompleters on shutdown

This commit is contained in:
James Booth 2014-06-12 20:03:19 +01:00
parent 8831715f7a
commit 9d96ae5190
4 changed files with 10 additions and 2 deletions

View File

@ -31,7 +31,7 @@ static GHashTable *autocompleters;
void
autocompleters_init(void)
{
autocompleters = g_hash_table_new(g_str_hash, g_str_equal);
autocompleters = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)autocomplete_free);
}
void
@ -72,4 +72,9 @@ autocompleters_reset(void)
autocomplete_reset(curr->data);
curr = g_list_next(curr);
}
}
void autocompleters_destroy(void)
{
g_hash_table_destroy(autocompleters);
}

View File

@ -29,5 +29,6 @@ void autocompleters_init(void);
void autocompleters_add(const char *key, char **items);
char* autocompleters_complete(char *input, int *size);
void autocompleters_reset(void);
void autocompleters_destroy(void);
#endif

View File

@ -413,6 +413,8 @@ plugins_shutdown(void)
#ifdef PROF_HAVE_C
c_shutdown();
#endif
autocompleters_destroy();
}
gchar *

View File

@ -26,7 +26,7 @@
#include <glib.h>
typedef char*(*autocomplete_func)(char *);
typedef struct autocomplete_t *Autocomplete;
typedef struct autocomplete_t* Autocomplete;
// allocate new autocompleter with no items
Autocomplete autocomplete_new(void);