Skip to content

Commit

Permalink
fix(ios): removing eventListener in location event will freeze app (#…
Browse files Browse the repository at this point in the history
…12645)

Fixes TIMOB-28275
  • Loading branch information
build committed Mar 23, 2021
1 parent a18fb68 commit 0749a30
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/ObjcProxy.m
Original file line number Diff line number Diff line change
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

0 comments on commit 0749a30

Please sign in to comment.