about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-08-26 17:47:29 +0100
committerJames Booth <boothj5@gmail.com>2013-08-26 17:47:29 +0100
commitbca379844de5b5d0cfdf2ba84fd23a4d542a0be0 (patch)
tree0e8cf5e57d9f3567e6739e188958f58045d75622 /src
parent18d11f2bcf72f6e7959434700f088b110cd71d3b (diff)
downloadprofani-tty-bca379844de5b5d0cfdf2ba84fd23a4d542a0be0.tar.gz
Free windows on exit
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c1
-rw-r--r--src/ui/window.c2
-rw-r--r--src/ui/windows.c11
-rw-r--r--src/ui/windows.h1
4 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 97825c95..0f928204 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -135,6 +135,7 @@ void
 ui_close(void)
 {
     notifier_uninit();
+    wins_destroy();
     endwin();
 }
 
diff --git a/src/ui/window.c b/src/ui/window.c
index b78a240f..7c6f9266 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -57,8 +57,6 @@ win_free(ProfWin* window)
 {
     delwin(window->win);
     free(window->from);
-    window->from = NULL;
-    window->win = NULL;
     free(window);
     window = NULL;
 }
diff --git a/src/ui/windows.c b/src/ui/windows.c
index 3f5d2d6b..c55dad74 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -455,3 +455,14 @@ wins_create_summary(void)
 
     return result;
 }
+
+void
+wins_destroy(void)
+{
+    int i;
+    for (i = 0; i < NUM_WINS; i++) {
+        if (windows[i] != NULL) {
+            win_free(windows[i]);
+        }
+    }
+}
diff --git a/src/ui/windows.h b/src/ui/windows.h
index 775cb79d..ee4d1c84 100644
--- a/src/ui/windows.h
+++ b/src/ui/windows.h
@@ -47,5 +47,6 @@ GSList * wins_get_prune_recipients(void);
 void wins_lost_connection(void);
 gboolean wins_tidy(void);
 GSList * wins_create_summary(void);
+void wins_destroy(void);
 
 #endif