summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-07-22 21:10:51 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-07-22 21:10:51 +0000
commita97b7ad11cc6415a120c08bb6598ec9e0ccc5194 (patch)
treef621b33a31423f107e23cb6f035f291aeabf9953
parent2b80ede9631b8236aa213c730cd6d91805e761f9 (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.
-rw-r--r--window-copy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/window-copy.c b/window-copy.c
index 3324fed3..186f018d 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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);