Make sure that the next pointers are NULL when we insert screens in the list.
This avoids the problem when screens are re-used that have stale pointers in them. This was not an issue with circleq's because all the pointers used to be updated.
This commit is contained in:
parent
f95f074778
commit
80e7303ab0
4
external/bsd/nvi/dist/common/exf.c
vendored
4
external/bsd/nvi/dist/common/exf.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: exf.c,v 1.5 2013/11/27 20:31:01 tron Exp $ */
|
||||
/* $NetBSD: exf.c,v 1.6 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -402,6 +402,7 @@ no_lock:
|
||||
|
||||
/* Switch... */
|
||||
++ep->refcnt;
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
TAILQ_INSERT_HEAD(&ep->scrq, sp, eq);
|
||||
sp->ep = ep;
|
||||
sp->frp = frp;
|
||||
@ -691,6 +692,7 @@ file_end(SCR *sp, EXF *ep, int force)
|
||||
if ((sp->db_error = db_close(ep->db)) != 0 &&
|
||||
!force) {
|
||||
msgq_str(sp, M_DBERR, frp->name, "241|%s: close");
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
TAILQ_INSERT_HEAD(&ep->scrq, sp, eq);
|
||||
++ep->refcnt;
|
||||
return (1);
|
||||
|
4
external/bsd/nvi/dist/common/main.c
vendored
4
external/bsd/nvi/dist/common/main.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
|
||||
/* $NetBSD: main.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -233,12 +233,14 @@ editor(WIN *wp, int argc, char **argv)
|
||||
*/
|
||||
if (screen_init(gp, NULL, &sp)) {
|
||||
if (sp != NULL) {
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
TAILQ_INSERT_HEAD(&wp->scrq, sp, q);
|
||||
sp->wp = wp;
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
F_SET(sp, SC_EX);
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
TAILQ_INSERT_HEAD(&wp->scrq, sp, q);
|
||||
sp->wp = wp;
|
||||
|
||||
|
3
external/bsd/nvi/dist/common/screen.c
vendored
3
external/bsd/nvi/dist/common/screen.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: screen.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
|
||||
/* $NetBSD: screen.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -227,6 +227,7 @@ screen_next(SCR *sp)
|
||||
/* Try the hidden queue; if found, move screen to the display queue. */
|
||||
if ((next = TAILQ_FIRST(&gp->hq)) != NULL) {
|
||||
TAILQ_REMOVE(&gp->hq, next, q);
|
||||
TAILQ_NEXT(next, q) = NULL;
|
||||
TAILQ_INSERT_HEAD(&wp->scrq, next, q);
|
||||
next->wp = sp->wp;
|
||||
return (next);
|
||||
|
3
external/bsd/nvi/dist/ex/ex_edit.c
vendored
3
external/bsd/nvi/dist/ex/ex_edit.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_edit.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
|
||||
/* $NetBSD: ex_edit.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -129,6 +129,7 @@ ex_N_edit(SCR *sp, EXCMD *cmdp, FREF *frp, int attach)
|
||||
/* Copy file state, keep the screen and cursor the same. */
|
||||
new->ep = sp->ep;
|
||||
++new->ep->refcnt;
|
||||
TAILQ_NEXT(new, eq) = NULL;
|
||||
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
|
||||
|
||||
new->frp = frp;
|
||||
|
3
external/bsd/nvi/dist/ex/ex_tag.c
vendored
3
external/bsd/nvi/dist/ex/ex_tag.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_tag.c,v 1.7 2013/11/28 03:15:02 christos Exp $ */
|
||||
/* $NetBSD: ex_tag.c,v 1.8 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -311,6 +311,7 @@ ex_tag_Nswitch(SCR *sp, TAG *tp, int force)
|
||||
/* Copy file state. */
|
||||
new->ep = sp->ep;
|
||||
++new->ep->refcnt;
|
||||
TAILQ_NEXT(new, eq) = NULL;
|
||||
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
|
||||
|
||||
new->frp = tp->frp;
|
||||
|
3
external/bsd/nvi/dist/vi/v_ex.c
vendored
3
external/bsd/nvi/dist/vi/v_ex.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: v_ex.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
|
||||
/* $NetBSD: v_ex.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -523,6 +523,7 @@ v_ecl(SCR *sp)
|
||||
/* Attach to the screen. */
|
||||
new->ep = wp->ccl_sp->ep;
|
||||
++new->ep->refcnt;
|
||||
TAILQ_NEXT(new, eq) = NULL;
|
||||
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
|
||||
|
||||
new->frp = wp->ccl_sp->frp;
|
||||
|
4
external/bsd/nvi/dist/vi/vi.c
vendored
4
external/bsd/nvi/dist/vi/vi.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vi.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
|
||||
/* $NetBSD: vi.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -1033,6 +1033,7 @@ v_dtoh(SCR *sp)
|
||||
_HMAP(tsp) = NULL;
|
||||
}
|
||||
TAILQ_REMOVE(&wp->scrq, tsp, q);
|
||||
TAILQ_NEXT(tsp, q) = NULL;
|
||||
TAILQ_INSERT_TAIL(&gp->hq, tsp, q);
|
||||
/* XXXX Change if hidden screens per window */
|
||||
tsp->wp = 0;
|
||||
@ -1041,6 +1042,7 @@ v_dtoh(SCR *sp)
|
||||
|
||||
/* Move current screen back to the display queue. */
|
||||
TAILQ_REMOVE(&gp->hq, sp, q);
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
TAILQ_INSERT_TAIL(&wp->scrq, sp, q);
|
||||
sp->wp = wp;
|
||||
|
||||
|
4
external/bsd/nvi/dist/vi/vs_split.c
vendored
4
external/bsd/nvi/dist/vi/vs_split.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vs_split.c,v 1.4 2013/11/27 14:21:31 mrg Exp $ */
|
||||
/* $NetBSD: vs_split.c,v 1.5 2013/11/28 23:19:43 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -317,6 +317,7 @@ vs_insert(SCR *sp, WIN *wp)
|
||||
* If we reached the end, this screen goes there. Otherwise,
|
||||
* put it before or after the screen where we stopped.
|
||||
*/
|
||||
TAILQ_NEXT(sp, q) = NULL;
|
||||
if (tsp == NULL) {
|
||||
TAILQ_INSERT_TAIL(&wp->scrq, sp, q);
|
||||
} else if (tsp->roff < sp->roff ||
|
||||
@ -781,6 +782,7 @@ vs_swap(SCR *sp, SCR **nspp, const char *name)
|
||||
* code will move the old one to the background queue.
|
||||
*/
|
||||
TAILQ_REMOVE(&gp->hq, nsp, q);
|
||||
TAILQ_NEXT(nsp, q) = NULL;
|
||||
TAILQ_INSERT_AFTER(&wp->scrq, sp, nsp, q);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user