summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-11-14 08:58:26 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-11-14 08:58:26 +0000
commit3a970e801cde9856adaa48db5b26863ac6137315 (patch)
tree04a610c83d1fe324df2178f8aae1cfbba6f72fe6 /usr.bin/tmux/window.c
parent02e1ff9a7cfe194b5528b069e3ac5cf75f9c6ac6 (diff)
Don't allow last and active window to become the same - a very bad move
when the active window is closed and freed. Reported by sthen@.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 9d02a5a8c9e..7b167c5d972 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.58 2010/10/23 13:04:34 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.59 2010/11/14 08:58:25 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -325,6 +325,8 @@ window_resize(struct window *w, u_int sx, u_int sy)
void
window_set_active_pane(struct window *w, struct window_pane *wp)
{
+ if (wp == w->active)
+ return;
w->last = w->active;
w->active = wp;
while (!window_pane_visible(w->active)) {
@@ -342,7 +344,7 @@ window_set_active_at(struct window *w, u_int x, u_int y)
struct window_pane *wp;
TAILQ_FOREACH(wp, &w->panes, entry) {
- if (!window_pane_visible(wp))
+ if (wp == w->active || !window_pane_visible(wp))
continue;
if (x < wp->xoff || x >= wp->xoff + wp->sx)
continue;