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

[TIMOB-25836] : iOS Using "run-on-main-thread", multiple global event listeners do not work #9908

Merged
merged 9 commits into from
May 21, 2018
3 changes: 2 additions & 1 deletion iphone/Classes/AppModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ - (void)fireEvent:(NSArray *)args

DebugLog(@"[DEBUG] Firing app event: %@", type);

NSArray *array = [appListeners objectForKey:type];
NSArray *array = [[appListeners objectForKey:type] copy];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should rather synchronize the appListeners setters, so nothing can be mutated during its write-process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it will slow the processing. And if there are not more use cases like this, we should avoid.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok then, taking your word!


if (array != nil && [array count] > 0) {
NSMutableDictionary *eventObject = nil;
Expand All @@ -208,6 +208,7 @@ - (void)fireEvent:(NSArray *)args
// fire application level event
[host fireEvent:[entry listener] withObject:jsonObject remove:NO context:[entry context] thisObject:nil];
}
[array release];
}
}
}
Expand Down