about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-07-07 21:29:51 +0100
committerJames Booth <boothj5@gmail.com>2014-07-07 21:29:51 +0100
commitb91f421628e35914e7f85580f0c1c5278e377462 (patch)
tree4deee3932bcca5c280d7521f0ca8db25fd43639c
parent1b135953691e7603642f815e29e03a31d9f08cf8 (diff)
downloadprofani-tty-b91f421628e35914e7f85580f0c1c5278e377462.tar.gz
Assign GPOINTER_TO_INT value before freeing
fixes #375
-rw-r--r--src/ui/windows.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ui/windows.c b/src/ui/windows.c
index c2052cd8..85345693 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -111,8 +111,9 @@ wins_get_next(void)
     // if there is a next window return it
     curr = g_list_next(curr);
     if (curr != NULL) {
+        int next = GPOINTER_TO_INT(curr->data);
         g_list_free(keys);
-        return wins_get_by_num(GPOINTER_TO_INT(curr->data));
+        return wins_get_by_num(next);
     // otherwise return the first window (console)
     } else {
         g_list_free(keys);
@@ -139,8 +140,9 @@ wins_get_previous(void)
     // if there is a previous window return it
     curr = g_list_previous(curr);
     if (curr != NULL) {
+        int previous = GPOINTER_TO_INT(curr->data);
         g_list_free(keys);
-        return wins_get_by_num(GPOINTER_TO_INT(curr->data));
+        return wins_get_by_num(previous);
     // otherwise return the last window
     } else {
         int new_num = GPOINTER_TO_INT(g_list_last(keys)->data);