summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-07-19 23:08:55 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-07-19 23:08:55 +0000
commit43b6856ba7c46518a574c5904fbe0cf87676df70 (patch)
tree3056c19f53646207bd5fb3ab12d2143abf6a8ff9 /render
parent1cd92d6d50f0a537b09fda344b53f44ce6c7db68 (diff)
downloadnetsurf-43b6856ba7c46518a574c5904fbe0cf87676df70.tar.gz
netsurf-43b6856ba7c46518a574c5904fbe0cf87676df70.tar.bz2
Make html_stop handle being called during construction of the box tree (i.e. as the result of a call to gui_multitask from the LOADING state)
Fixup accounting of active objects when stopped in the READY state and ensure correct transition to the DONE state when necessary svn path=/trunk/netsurf/; revision=12612
Diffstat (limited to 'render')
-rw-r--r--render/html.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/render/html.c b/render/html.c
index f494261c6..1b686c255 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1729,6 +1729,26 @@ void html_stop(struct content *c)
switch (c->status) {
case CONTENT_STATUS_LOADING:
+ /* Clear up objects if we were stopped after queuing up some
+ * fetches within xml_to_box (i.e. gui_multitask is somewhere
+ * in our call stack) */
+ for (object = htmlc->object_list; object != NULL;
+ object = object->next) {
+ if (object->content == NULL)
+ continue;
+
+ /* If there's a content already associated with our
+ * handle, something's gone very wrong */
+ assert(content_get_status(object->content) ==
+ CONTENT_STATUS_ERROR);
+
+ hlcache_handle_abort(object->content);
+ hlcache_handle_release(object->content);
+ object->content = NULL;
+
+ c->active--;
+ }
+
/* Still loading; simply flag that we've been aborted
* html_convert/html_finish_conversion will do the rest */
htmlc->aborted = true;
@@ -1745,12 +1765,25 @@ void html_stop(struct content *c)
else if (content_get_status(object->content) ==
CONTENT_STATUS_READY)
hlcache_handle_abort(object->content);
+ /* Active count will be updated when
+ * html_object_callback receives
+ * CONTENT_MSG_DONE from this object */
else {
+ hlcache_handle_abort(object->content);
hlcache_handle_release(object->content);
object->content = NULL;
+
+ c->active--;
}
}
- c->status = CONTENT_STATUS_DONE;
+
+ /* If there are no further active fetches and we're still
+ * in the READY state, transition to the DONE state. */
+ if (c->status == CONTENT_STATUS_READY && c->active == 0) {
+ html_set_status(htmlc, "");
+ content_set_done(c);
+ }
+
break;
case CONTENT_STATUS_DONE:
/* Nothing to do */
@@ -1908,9 +1941,9 @@ void html_destroy(struct content *c)
while (html->object_list != NULL) {
struct content_html_object *victim = html->object_list;
- LOG(("object %p", victim->content));
-
if (victim->content != NULL) {
+ LOG(("object %p", victim->content));
+
if (content_get_type(victim->content) == CONTENT_HTML)
schedule_remove(html_object_refresh, victim);