summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-02-27 18:38:41 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-02-27 18:38:41 +0000
commit89793c21712fe11a1c52452911f12ac38e275d28 (patch)
treed054315208d4512c64c71e30e72079e5d8984a9e
parent748937547a27e58979c2c8385dd9aec5e62aa9da (diff)
downloadnetsurf-89793c21712fe11a1c52452911f12ac38e275d28.tar.gz
netsurf-89793c21712fe11a1c52452911f12ac38e275d28.tar.bz2
Make content_reset actually do what it's meant to (i.e. reset the appropriate members)
Fix up CONTENT_MSG_REFRESH scheduled events to gracefully the refresh URL disappearing from under them. svn path=/trunk/netsurf/; revision=3870
-rw-r--r--content/content.c7
-rw-r--r--desktop/browser.c10
-rw-r--r--render/html.c7
3 files changed, 21 insertions, 3 deletions
diff --git a/content/content.c b/content/content.c
index 9310eb180..19bb45b0a 100644
--- a/content/content.c
+++ b/content/content.c
@@ -931,6 +931,13 @@ void content_reset(struct content *c)
c->size = 0;
talloc_free(c->mime_type);
c->mime_type = 0;
+ talloc_free(c->refresh);
+ c->refresh = 0;
+ talloc_free(c->title);
+ c->title = 0;
+ talloc_free(c->source_data);
+ c->source_data = 0;
+ c->source_size = c->source_allocated = 0;
}
diff --git a/desktop/browser.c b/desktop/browser.c
index 27fcd6ad1..ee3e7eed5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -648,8 +648,14 @@ void browser_window_refresh(void *p)
struct browser_window *bw = p;
bool history_add = true;
- assert(bw->current_content->status == CONTENT_STATUS_READY ||
- bw->current_content->status == CONTENT_STATUS_DONE);
+ assert(bw->current_content &&
+ (bw->current_content->status == CONTENT_STATUS_READY ||
+ bw->current_content->status == CONTENT_STATUS_DONE));
+
+ /* Ignore if the refresh URL has gone
+ * (may happen if a fetch error occurred) */
+ if (!bw->current_content->refresh)
+ return;
/* mark this content as invalid so it gets flushed from the cache */
bw->current_content->fresh = false;
diff --git a/render/html.c b/render/html.c
index 0c55bd805..b51510d3d 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1563,7 +1563,12 @@ void html_object_refresh(void *p)
{
struct content *c = (struct content *)p;
- assert(c->type == CONTENT_HTML && c->refresh);
+ assert(c->type == CONTENT_HTML);
+
+ /* Ignore if refresh URL has gone
+ * (may happen if fetch errored) */
+ if (!c->refresh)
+ return;
c->fresh = false;