Fix crashes in android when removing/recreating views and surfaces #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem(s)
On Android there is a bug in the viewManager where the nativeId and view was stored as private variables in the manager. This is of course totally wrong - since a view manager manages multiple views.
In addition the Android view crashes from time to time after it is removed in the
drawFrame
method, and it is currently not possible for a view to continue redrawing after its underlying surface has been removed/recreated,Solutions
This PR fixes this ViewManager issue by storing a map of views and nativeIds instead of the private variables.
It also contains a fix to the
drawFrame
method so that it checks to see if the view is removed before drawing.A check for a nullptr has been added to the
ensureSkiaRenderTarget
in the´JniSkiaDrawView` class to make sure a view can have its underlying texture surface destroyed and recreated without the view crashing.Fixes #15