mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 14:27:09 +00:00
Sync OpenBSD patchset 852:
Check if the index is in use and fail before creating the child process, rather than leaving a stray child on failure.
This commit is contained in:
26
window.c
26
window.c
@ -1,4 +1,4 @@
|
||||
/* $Id: window.c,v 1.144 2011-01-21 23:44:13 tcunha Exp $ */
|
||||
/* $Id: window.c,v 1.145 2011-02-15 15:09:52 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -120,7 +120,7 @@ winlink_count(struct winlinks *wwl)
|
||||
}
|
||||
|
||||
struct winlink *
|
||||
winlink_add(struct winlinks *wwl, struct window *w, int idx)
|
||||
winlink_add(struct winlinks *wwl, int idx)
|
||||
{
|
||||
struct winlink *wl;
|
||||
|
||||
@ -132,14 +132,18 @@ winlink_add(struct winlinks *wwl, struct window *w, int idx)
|
||||
|
||||
wl = xcalloc(1, sizeof *wl);
|
||||
wl->idx = idx;
|
||||
wl->window = w;
|
||||
RB_INSERT(winlinks, wwl, wl);
|
||||
|
||||
w->references++;
|
||||
|
||||
return (wl);
|
||||
}
|
||||
|
||||
void
|
||||
winlink_set_window(struct winlink *wl, struct window *w)
|
||||
{
|
||||
wl->window = w;
|
||||
w->references++;
|
||||
}
|
||||
|
||||
void
|
||||
winlink_remove(struct winlinks *wwl, struct winlink *wl)
|
||||
{
|
||||
@ -150,11 +154,13 @@ winlink_remove(struct winlinks *wwl, struct winlink *wl)
|
||||
xfree(wl->status_text);
|
||||
xfree(wl);
|
||||
|
||||
if (w->references == 0)
|
||||
fatal("bad reference count");
|
||||
w->references--;
|
||||
if (w->references == 0)
|
||||
window_destroy(w);
|
||||
if (w != NULL) {
|
||||
if (w->references == 0)
|
||||
fatal("bad reference count");
|
||||
w->references--;
|
||||
if (w->references == 0)
|
||||
window_destroy(w);
|
||||
}
|
||||
}
|
||||
|
||||
struct winlink *
|
||||
|
Reference in New Issue
Block a user