Skip to content

Commit

Permalink
fix(database): Fix crash when removing listeners at RN reload (invert…
Browse files Browse the repository at this point in the history
…ase#2770)

* Fixed crash when removing listeners caused by modifying an object while enumerating it
* Use allKeys instead of copy
  • Loading branch information
ismarbesic authored and Salakar committed Oct 25, 2019
1 parent 35e9388 commit e2b1b6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/database/ios/RNFBDatabase/RNFBDatabaseQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ - (void)removeEventListener:(NSString *)eventRegistrationKey {
}

- (void)removeAllEventListeners {
for (NSString * eventRegistrationKey in _listeners) {
NSArray *listeners = [_listeners allKeys];

for (NSString *eventRegistrationKey in listeners) {
[self removeEventListener:eventRegistrationKey];
}
}
Expand Down

0 comments on commit e2b1b6f

Please sign in to comment.