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
This commit is contained in:
John Mark Bell 2008-02-27 18:38:41 +00:00
parent 748937547a
commit 89793c2171
3 changed files with 21 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;