summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-07-22 21:10:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-07-22 21:10:52 +0000
commitb5837218ed6b795b599f483d6d6da442723a8aad (patch)
tree1715c561eeeea757277d04996bcb9c667e1f02fc /usr.bin/tmux/window-copy.c
parent61d2b341a4c1ab7b61fcc066428c5135a79dca48 (diff)
Fix a crash: if remain-on-exit is set and the pane has exited, the
buffers may not be valid, so do not try to disable/enable them when switching to copy mode.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 97b71afc319..55da4992104 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.60 2010/06/29 05:24:49 tedu Exp $ */
+/* $OpenBSD: window-copy.c,v 1.61 2010/07/22 21:10:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -171,7 +171,8 @@ window_copy_init(struct window_pane *wp)
data->searchstr = NULL;
wp->flags |= PANE_FREEZE;
- bufferevent_disable(wp->event, EV_READ|EV_WRITE);
+ if (wp->fd != -1)
+ bufferevent_disable(wp->event, EV_READ|EV_WRITE);
data->jumptype = WINDOW_COPY_OFF;
data->jumpchar = '\0';
@@ -234,7 +235,8 @@ window_copy_free(struct window_pane *wp)
struct window_copy_mode_data *data = wp->modedata;
wp->flags &= ~PANE_FREEZE;
- bufferevent_enable(wp->event, EV_READ|EV_WRITE);
+ if (wp->fd != -1)
+ bufferevent_enable(wp->event, EV_READ|EV_WRITE);
if (data->searchstr != NULL)
xfree(data->searchstr);