summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-02 16:57:55 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-02 16:57:55 +0100
commit4421d1bab6529132ee8b8988d2c2e538002906f5 (patch)
treef80851a04d29072bad49553099fff8fb98c6f578 /content
parentf7d97d64836a042effd52a894ed8b1abeff46960 (diff)
downloadnetsurf-4421d1bab6529132ee8b8988d2c2e538002906f5.tar.gz
netsurf-4421d1bab6529132ee8b8988d2c2e538002906f5.tar.bz2
llcache: Ensure we preserve iteratorness when sending messages
In order to prevent a problem where iterating causes an abort which causes an iteration which clears the iteratorness of a user allowing it to delete itself causing a segfault, preserve the iteratorness when iterating in send_message Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content')
-rw-r--r--content/llcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/content/llcache.c b/content/llcache.c
index ff21d29ab..34b43d702 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -393,6 +393,7 @@ static nserror llcache_send_event_to_users(llcache_object *object,
user = object->users;
while (user != NULL) {
+ bool was_target = user->iterator_target;
user->iterator_target = true;
error = user->handle->cb(user->handle, event,
@@ -400,7 +401,7 @@ static nserror llcache_send_event_to_users(llcache_object *object,
next_user = user->next;
- user->iterator_target = false;
+ user->iterator_target = was_target;
if (user->queued_for_delete) {
llcache_object_remove_user(object, user);