From 1437c360b5da795341d0e0603bd41cdb10196b4c Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 25 Jul 2016 00:57:42 +0100 Subject: [PATCH] Free old hash table on wins_tidy --- src/ui/window_list.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/window_list.c b/src/ui/window_list.c index 402fbdc1..057d2033 100644 --- a/src/ui/window_list.c +++ b/src/ui/window_list.c @@ -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();