From 308f549f7849da791ca1b52df67fcf0ccc09e6af Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 23 Feb 2011 22:41:17 +0000 Subject: Fix backend fetcher poll loops svn path=/trunk/netsurf/; revision=11775 --- content/fetchers/resource.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'content/fetchers/resource.c') diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index 2818305d0..c8fb060b6 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -234,10 +234,6 @@ static void fetch_resource_poll(const char *scheme) /* Iterate over ring, processing each pending fetch */ c = ring; do { - /* Take a copy of the next pointer as we may destroy - * the ring item we're currently processing */ - next = c->r_next; - /* Ignore fetches that have been flagged as locked. * This allows safe re-entrant calls to this function. * Re-entrancy can occur if, as a result of a callback, @@ -245,6 +241,7 @@ static void fetch_resource_poll(const char *scheme) * again. */ if (c->locked == true) { + next = c->r_next; continue; } @@ -254,6 +251,10 @@ static void fetch_resource_poll(const char *scheme) c->handler(c); } + /* Compute next fetch item at the last possible moment + * as processing this item may have added to the ring + */ + next = c->r_next; fetch_remove_from_queues(c->fetchh); fetch_free(c->fetchh); -- cgit v1.2.3