From c675c3552d5ddb436034dd6400bccfd40efb816c Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 15 Dec 2010 22:59:19 +0000 Subject: [PATCH] Ensure that we clean up after the client even if they report an error from their notification callback. svn path=/trunk/netsurf/; revision=11067 --- content/llcache.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/content/llcache.c b/content/llcache.c index cd1beb6fc..81539afd2 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -637,8 +637,6 @@ static nserror llcache_send_event_to_users(llcache_object *object, error = user->handle->cb(user->handle, event, user->handle->pw); - if (error != NSERROR_OK) - break; next_user = user->next; @@ -649,6 +647,9 @@ static nserror llcache_send_event_to_users(llcache_object *object, llcache_object_user_destroy(user); } + if (error != NSERROR_OK) + break; + user = next_user; } @@ -1443,16 +1444,19 @@ nserror llcache_object_notify_users(llcache_object *object) event.type = LLCACHE_EVENT_HAD_HEADERS; error = handle->cb(handle, &event, handle->pw); - if (error != NSERROR_OK) { - user->iterator_target = false; - return error; - } if (user->queued_for_delete) { next_user = user->next; llcache_object_remove_user(object, user); llcache_object_user_destroy(user); + + if (error != NSERROR_OK) + return error; + continue; + } else if (error != NSERROR_OK) { + user->iterator_target = false; + return error; } } @@ -1479,16 +1483,18 @@ nserror llcache_object_notify_users(llcache_object *object) /* Emit event */ error = handle->cb(handle, &event, handle->pw); - if (error != NSERROR_OK) { - user->iterator_target = false; - return error; - } - if (user->queued_for_delete) { next_user = user->next; llcache_object_remove_user(object, user); llcache_object_user_destroy(user); + + if (error != NSERROR_OK) + return error; + continue; + } else if (error != NSERROR_OK) { + user->iterator_target = false; + return error; } } @@ -1501,16 +1507,18 @@ nserror llcache_object_notify_users(llcache_object *object) event.type = LLCACHE_EVENT_DONE; error = handle->cb(handle, &event, handle->pw); - if (error != NSERROR_OK) { - user->iterator_target = false; - return error; - } - if (user->queued_for_delete) { next_user = user->next; llcache_object_remove_user(object, user); llcache_object_user_destroy(user); + + if (error != NSERROR_OK) + return error; + continue; + } else if (error != NSERROR_OK) { + user->iterator_target = false; + return error; } }