1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Free old hash table on wins_tidy

This commit is contained in:
James Booth 2016-07-25 00:57:42 +01:00
parent 8f9f018d5a
commit 1437c360b5

View File

@ -61,8 +61,7 @@ static int _wins_get_next_available_num(GList *used);
void
wins_init(void)
{
windows = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
(GDestroyNotify)win_free);
windows = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)win_free);
ProfWin *console = win_create_console();
g_hash_table_insert(windows, GINT_TO_POINTER(1), console);
@ -1000,6 +999,7 @@ wins_tidy(void)
GList *curr = keys;
while (curr) {
ProfWin *window = g_hash_table_lookup(windows, curr->data);
g_hash_table_steal(windows, curr->data);
if (num == 10) {
g_hash_table_insert(new_windows, GINT_TO_POINTER(0), window);
if (win_unread(window) > 0) {
@ -1019,6 +1019,7 @@ wins_tidy(void)
curr = g_list_next(curr);
}
g_hash_table_destroy(windows);
windows = new_windows;
current = 1;
ProfWin *console = wins_get_console();