summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-12 21:38:19 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-12 21:38:19 +0200
commit4d770fb56635162a9a7a0a7cdfc48627bb25faec (patch)
tree6e29c0e9266add0fab063ae195fa41ccb444fb34 /src/window.c
parent2cefbedaab00fe32c8f39718e9c64921f8660be2 (diff)
downloadvim-git-4d770fb56635162a9a7a0a7cdfc48627bb25faec.tar.gz
updated for version 7.2.446
Problem: Crash in GUI when closing the last window in a tabpage. (ryo7000) Solution: Remove the tabpage from the list before freeing the window.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c
index 9f7131e90..c2590e5f9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2307,6 +2307,7 @@ win_close_othertab(win, free_buf, tp)
win_T *wp;
int dir;
tabpage_T *ptp = NULL;
+ int free_tp = FALSE;
/* Close the link to the buffer. */
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0);
@@ -2324,11 +2325,8 @@ win_close_othertab(win, free_buf, tp)
if (wp == NULL)
return;
- /* Free the memory used for the window. */
- wp = win_free_mem(win, &dir, tp);
-
/* When closing the last window in a tab page remove the tab page. */
- if (wp == NULL)
+ if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin)
{
if (tp == first_tabpage)
first_tabpage = tp->tp_next;
@@ -2344,8 +2342,14 @@ win_close_othertab(win, free_buf, tp)
}
ptp->tp_next = tp->tp_next;
}
- free_tabpage(tp);
+ free_tp = TRUE;
}
+
+ /* Free the memory used for the window. */
+ win_free_mem(win, &dir, tp);
+
+ if (free_tp)
+ free_tabpage(tp);
}
/*