From 36e537bcef59cdf194cacf3584b748d49554b32a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 6 Dec 2010 21:53:50 +0000 Subject: [PATCH] PatchSet 786 Date: 2010/11/14 08:58:25 Author: nicm Branch: HEAD Tag: (none) Log: 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@. Members: window.c:1.58->1.59 --- window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/window.c b/window.c index 1c9160bc..f81acc4f 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.140 2010-10-24 01:34:30 tcunha Exp $ */ +/* $Id: window.c,v 1.141 2010-12-06 21:53:50 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -322,6 +322,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)) { @@ -339,7 +341,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;