about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-07-25 00:57:42 +0100
committerJames Booth <boothj5@gmail.com>2016-07-25 00:57:42 +0100
commit1437c360b5da795341d0e0603bd41cdb10196b4c (patch)
tree5128b6ed9fbde327bb7c53fca03898db2296b716 /src
parent8f9f018d5a2f80267783477c7f8cce8869cf5528 (diff)
downloadprofani-tty-1437c360b5da795341d0e0603bd41cdb10196b4c.tar.gz
Free old hash table on wins_tidy
Diffstat (limited to 'src')
-rw-r--r--src/ui/window_list.c5
1 files 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();