From 770a3f7494d576cb539e8b382c7743e4991ee6c8 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Thu, 24 Mar 2005 13:44:24 +0000 Subject: [project @ 2005-03-24 13:44:24 by rjw] Don't add fetches that failed to initialise to the object list. svn path=/import/netsurf/; revision=1580 --- render/html.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'render/html.c') diff --git a/render/html.c b/render/html.c index fdc0edbe0..60e29f694 100644 --- a/render/html.c +++ b/render/html.c @@ -726,27 +726,33 @@ bool html_fetch_object(struct content *c, char *url, struct box *box, { unsigned int i = c->data.html.object_count; struct content_html_object *object; + struct content *c_fetch; + + /* initialise fetch */ + c_fetch = fetchcache(url, html_object_callback, + c, (void *) i, available_width, available_height, + true, 0, 0, false, false); + if (!c_fetch) + return false; /* add to object list */ object = realloc(c->data.html.object, (i + 1) * sizeof *c->data.html.object); - if (!object) + if (!object) { + content_remove_user(c_fetch, html_object_callback, c, (void*)i); return false; + } c->data.html.object = object; c->data.html.object[i].url = url; c->data.html.object[i].box = box; c->data.html.object[i].permitted_types = permitted_types; c->data.html.object[i].background = background; + c->data.html.object[i].content = c_fetch; c->data.html.object_count++; + c->active++; /* start fetch */ - c->data.html.object[i].content = fetchcache(url, html_object_callback, - c, (void *) i, available_width, available_height, - true, 0, 0, false, false); - if (!c->data.html.object[i].content) - return false; - c->active++; - fetchcache_go(c->data.html.object[i].content, c->url, + fetchcache_go(c_fetch, c->url, html_object_callback, c, (void *) i, available_width, available_height, 0, 0, false); -- cgit v1.2.3