Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash due to concurrent writes to frameCallbacks vector (software…
…-mansion#3859) ## Summary This PR fixes crashes related to concurrent writes to a non-thread-safe frameCallbacks vector. The primary role of frameCallbacks vector was to facilitate requestAnimationFrame calls and hence it has not been designed to allow for other than the main thread to append their callbacks. However, after recent rewrite software-mansion#3722 we introduced a new methods "scheduleOnUI" that was originally meant to interface with a thread-safe scheduler API but was later updated (see c8a77da) to use frameCallbacks in order for errors to be handled using the same code-path the rAF uses. That change introduces a bug in which we'd access and modify that vector from different threads which is undesirable. This PR reverts that change and since software-mansion#3846 provides a better way of handling JS-errors there is no longer need for scheduleOnUI callbacks to go throught the requestAnimationFrame codepath. ## Test plan The easiest way to reproduce the crash we could find was by using BokehExample.tsx on Android. This would normally result in a crash after a couple of seconds of running. With the increased number of circles in that example (e.g. 400) the crash would be almost immediate. This change was tested on that example with 400 circles and the crash would not appear even after some time after launch (few minutes). Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com> Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com> Co-authored-by: Juliusz Wajgelt <49338439+jwajgelt@users.noreply.github.com>
- Loading branch information