Ensure that we clean up after the client even if they report an error from their notification callback.

svn path=/trunk/netsurf/; revision=11067
This commit is contained in:
John Mark Bell 2010-12-15 22:59:19 +00:00
parent a2a0e25382
commit c675c3552d
1 changed files with 24 additions and 16 deletions

View File

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