Fix bug #3452421: retain hlcache retrieval context when reporting errors & rely on clients correctly releasing handles to clean up.

svn path=/trunk/netsurf/; revision=13250
This commit is contained in:
John Mark Bell 2011-12-06 20:47:15 +00:00
parent c673ba6c23
commit 3ba6a15fa7
1 changed files with 7 additions and 9 deletions

View File

@ -607,9 +607,6 @@ nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
content_type type = CONTENT_NONE;
nserror error = NSERROR_OK;
/* Unlink the context to prevent recursion */
RING_REMOVE(hlcache->retrieval_ctx_ring, ctx);
if (effective_type != NULL &&
hlcache_type_is_acceptable(effective_type,
ctx->accepted_types, &type)) {
@ -623,8 +620,8 @@ nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
ctx->handle->cb(ctx->handle, &hlevent,
ctx->handle->pw);
llcache_handle_abort(ctx->llcache);
llcache_handle_release(ctx->llcache);
/* ctx cleaned up by client releasing handle */
return error;
}
} else if (type == CONTENT_NONE &&
(ctx->flags & HLCACHE_RETRIEVE_MAY_DOWNLOAD)) {
@ -644,10 +641,7 @@ nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
/* Ensure caller knows we need data */
error = NSERROR_NEED_DATA;
} else {
/* Unacceptable type: abort fetch and report error */
llcache_handle_abort(ctx->llcache);
llcache_handle_release(ctx->llcache);
/* Unacceptable type: report error */
if (ctx->handle->cb != NULL) {
hlcache_event hlevent;
@ -657,9 +651,13 @@ nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
ctx->handle->cb(ctx->handle, &hlevent,
ctx->handle->pw);
}
/* ctx cleaned up by client releasing handle */
return NSERROR_OK;
}
/* No longer require retrieval context */
RING_REMOVE(hlcache->retrieval_ctx_ring, ctx);
free((char *) ctx->child.charset);
free(ctx);