Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix ios race conditions #72

Merged
merged 13 commits into from
Jan 3, 2022
Merged

Fix ios race conditions #72

merged 13 commits into from
Jan 3, 2022

Conversation

chrfalch
Copy link
Contributor

Problem:

On iOS the process of removing and unregistering a SkiaView is a bit more complicated than on Android, since the iOS RCTViewManager does not have a notification for a view removal. This causes a memory leak and we need to track adding/removing the SkiaView by using the willMoveToWindow on the wrapping UIView. This causes some issues with the implementation of the RNSkDrawView not being available when we create/remove the view (ex. in navigation transitions). In addition all of this can cause a race condition where the view is removed while it has a pending draw request that will be executed after the view was removed.

Fixes

  • Implements correct tracking of view add/remove using the willMoveToWindow method
  • Refactored some of the RNSk code to support adding removing an implementation view without removing callbacks etc
  • Refactored how we track removal and draw requests to support this scheme

Fixes #71

chrfalch and others added 12 commits December 29, 2021 10:53
- Moved nativeId to separate get/set
- Fixed issue with sign on _drawingLooop
With this method a view can be "paused" and removed and readded without tearing down everything.

Also refactored to use the setnativeId() method on the view
Removed the lock on setting up the SkiaApi
- Refactored to support adding/removing the SkiaView when the willMoveToWindow is called.
@wcandillon wcandillon self-requested a review January 3, 2022 14:31
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix issue with race-condition in SkiaDrawView on iOS
2 participants