From 3a970e801cde9856adaa48db5b26863ac6137315 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 14 Nov 2010 08:58:26 +0000 Subject: 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@. --- usr.bin/tmux/window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.bin/tmux/window.c') 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 @@ -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; -- cgit v1.2.3