diff options
author | wtchang%redhat.com <devnull@localhost> | 2005-04-28 22:39:40 +0000 |
---|---|---|
committer | wtchang%redhat.com <devnull@localhost> | 2005-04-28 22:39:40 +0000 |
commit | 6fe9e6c57b02d851c795731eda2c592af32e808d (patch) | |
tree | e3650ec4c13ba0d807ea87e5297f68b8bc5b80e6 | |
parent | a7ff1abac180ad2485ae09864c901c90988318a5 (diff) | |
download | nspr-hg-6fe9e6c57b02d851c795731eda2c592af32e808d.tar.gz |
Bugzilla Bug 291982: fixed a bug when we remove an item from a list
while iterating through the list. The bug was reported and tracked down by
kamil@good.com. a=asa for mozilla1.8b2 and aviary1.1a.
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r-- | pr/src/misc/prtpool.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pr/src/misc/prtpool.c b/pr/src/misc/prtpool.c index fbedd7de..e23bb9d0 100644 --- a/pr/src/misc/prtpool.c +++ b/pr/src/misc/prtpool.c @@ -312,7 +312,7 @@ static void io_wstart(void *arg) PRThreadPool *tp = (PRThreadPool *) arg; int pollfd_cnt, pollfds_used; int rv; -PRCList *qp; +PRCList *qp, *nextqp; PRPollDesc *pollfds; PRJob **polljobs; int poll_timeout; @@ -365,7 +365,8 @@ PRIntervalTime now; * fill in the pollfd array */ PR_Lock(tp->ioq.lock); - for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = qp->next) { + for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = nextqp) { + nextqp = qp->next; jobp = JOB_LINKS_PTR(qp); if (jobp->cancel_io) { CANCEL_IO_JOB(jobp); @@ -489,7 +490,8 @@ PRIntervalTime now; */ now = PR_IntervalNow(); PR_Lock(tp->ioq.lock); - for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = qp->next) { + for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = nextqp) { + nextqp = qp->next; jobp = JOB_LINKS_PTR(qp); if (jobp->cancel_io) { CANCEL_IO_JOB(jobp); |