summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-03-03 00:40:50 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-03-03 00:40:50 +0000
commit60b5039c339d5d06d16d27f4a241b56aee7284c8 (patch)
tree2aa3c24165f1c8e9009b2138df01dd3b87f53aa6 /content
parentcfe6b8cc66b7a1423e807bcde4fd6fb94a274c00 (diff)
downloadnetsurf-60b5039c339d5d06d16d27f4a241b56aee7284c8.tar.gz
netsurf-60b5039c339d5d06d16d27f4a241b56aee7284c8.tar.bz2
Protect against object being cleaned while waiting for a query response
svn path=/trunk/netsurf/; revision=11894
Diffstat (limited to 'content')
-rw-r--r--content/llcache.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/content/llcache.c b/content/llcache.c
index c398620c0..1deb8cae9 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -84,6 +84,8 @@ typedef struct {
uint32_t redirect_count; /**< Count of redirects followed */
bool tried_with_auth; /**< Whether we've tried with auth */
+
+ bool outstanding_query; /**< Waiting for a query response */
} llcache_fetch_ctx;
typedef enum {
@@ -1634,7 +1636,8 @@ nserror llcache_clean(void)
/* The candidate count of uncacheable objects is always 0 */
if (object->users == NULL && object->candidate_count == 0 &&
- object->fetch.fetch == NULL) {
+ object->fetch.fetch == NULL &&
+ object->fetch.outstanding_query == false) {
#ifdef LLCACHE_TRACE
LOG(("Found victim %p", object));
#endif
@@ -1652,7 +1655,8 @@ nserror llcache_clean(void)
if (object->users == NULL && object->candidate_count == 0 &&
llcache_object_is_fresh(object) == false &&
- object->fetch.fetch == NULL) {
+ object->fetch.fetch == NULL &&
+ object->fetch.outstanding_query == false) {
#ifdef LLCACHE_TRACE
LOG(("Found victim %p", object));
#endif
@@ -1673,7 +1677,9 @@ nserror llcache_clean(void)
if (object->users == NULL &&
object->candidate_count == 0 &&
- object->fetch.fetch == NULL) {
+ object->fetch.fetch == NULL &&
+ object->fetch.outstanding_query ==
+ false) {
#ifdef LLCACHE_TRACE
LOG(("Found victim %p", object));
#endif
@@ -1747,6 +1753,8 @@ nserror llcache_query_handle_response(bool proceed, void *cbpw)
llcache_event event;
llcache_object *object = cbpw;
+ object->fetch.outstanding_query = false;
+
/* Refetch, using existing fetch parameters, if client allows us to */
if (proceed)
return llcache_object_refetch(object);
@@ -2451,6 +2459,8 @@ nserror llcache_fetch_auth(llcache_object *object, const char *realm)
query.url = object->url;
query.data.auth.realm = realm;
+ object->fetch.outstanding_query = true;
+
error = query_cb(&query, query_cb_pw,
llcache_query_handle_response, object);
} else {
@@ -2504,6 +2514,8 @@ nserror llcache_fetch_cert_error(llcache_object *object,
query.data.ssl.certs = certs;
query.data.ssl.num = num;
+ object->fetch.outstanding_query = true;
+
error = query_cb(&query, query_cb_pw,
llcache_query_handle_response, object);
} else {