mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
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>
This commit is contained in:
parent
f7d97d6483
commit
4421d1bab6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user