diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-02-24 09:46:59 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-02-24 09:46:59 +0000 |
commit | 89e468422d8a885030120396b69e0fe488041aca (patch) | |
tree | 5cbbb5ee97fa8f06ed7dc499f1cd27b74faa3762 /content/fetchers | |
parent | 5a028f61d3968a90870706e272bf4e1cd91dde5c (diff) | |
download | netsurf-89e468422d8a885030120396b69e0fe488041aca.tar.gz netsurf-89e468422d8a885030120396b69e0fe488041aca.tar.bz2 |
about: Correct handling of ring in fetch_about_poll
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/fetchers')
-rw-r--r-- | content/fetchers/about.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 02bac8175..4b8562cac 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -1644,6 +1644,7 @@ static void fetch_about_abort(void *ctx) static void fetch_about_poll(lwc_string *scheme) { struct fetch_about_context *c, *next; + bool was_last_item = false; if (ring == NULL) return; @@ -1671,14 +1672,28 @@ static void fetch_about_poll(lwc_string *scheme) * as processing this item may have added to the ring */ next = c->r_next; + was_last_item = next == c; fetch_remove_from_queues(c->fetchh); fetch_free(c->fetchh); + /* Having called into the fetch machinery, our ring might + * have been updated + */ + if (was_last_item) { + /* We were previously the last item in the ring + * so let's reset to the head of the ring + * and try again + */ + c = ring; + } else { + c = next; + } + /* Advance to next ring entry, exiting if we've reached * the start of the ring or the ring has become empty */ - } while ( (c = next) != ring && ring != NULL); + } while (ring != NULL); } |