Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): removing eventListener in location event will freeze app #12542

Merged
merged 3 commits into from
Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/ObjcProxy.m
Expand Up @@ -251,19 +251,22 @@ - (void)fireEvent:(NSString *)name withDict:(NSDictionary *)dict
pthread_rwlock_rdlock(&_listenerLock);
@try {
if (_listeners == nil) {
pthread_rwlock_unlock(&_listenerLock);
return;
}
NSArray *listenersForType = [_listeners objectForKey:name];
NSArray *listenersForType = [[_listeners objectForKey:name] copy];
pthread_rwlock_unlock(&_listenerLock);

if (listenersForType == nil) {
return;
}
// FIXME: looks like we need to handle bubble logic/etc. See other fireEvent impl
for (JSValue *storedCallback in listenersForType) {
[self _fireEventToListener:name withObject:dict listener:storedCallback];
}
[listenersForType autorelease];
}
@finally {
pthread_rwlock_unlock(&_listenerLock);
}
}

Expand Down