Skip to content

Commit

Permalink
fix(storage, ios): dont enumerate on dictionary being mutated (#5455)
Browse files Browse the repository at this point in the history
Avoid a possible crash during storage dealloc by iterating on a copy of the
array being mutated instead of the array itself
  • Loading branch information
danielhover authored Jun 25, 2021
1 parent 0d26af9 commit daaa72d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/storage/ios/RNFBStorage/RNFBStorageModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ - (id)init {
}

- (void)dealloc {
for (NSString *key in PENDING_TASKS) {
for (NSString *key in [PENDING_TASKS allKeys]) {
[PENDING_TASKS removeObjectForKey:key];
}
}

- (void)invalidate {
for (NSString *key in PENDING_TASKS) {
for (NSString *key in [PENDING_TASKS allKeys]) {
[PENDING_TASKS removeObjectForKey:key];
}
}
Expand Down

1 comment on commit daaa72d

@vercel
Copy link

@vercel vercel bot commented on daaa72d Jun 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.