- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Android] Cleanup animated sensors in NativeProxy destructor #3954
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
Conversation
82a883d
to
9cce3f0
Compare
Hi, sorry if this is not the right place for this, but you guys are planning to release a 2.x.x version for this fix ? @jwajgelt I'm currently facing a issue similar to #2710 and #3645. When we reload the app after a codepush update, sometimes the app crashes and after making a patch using patch-package with almost all the changes that this PR contains, the app seems to not crash anymore. One more thing, can you guys validate if this patch can break something on 2.14.4 ?
I didn't find where to put this lines of code:
and this part, the function doesn't seems to have the same signature, so I didn't make the change the line on 2.14.4:
and in this PR:
|
Hi @DenianFossatti ! At the moment we didn't plan on backporting this PR to v2. Have you tried upgrading to v3? While the current version is marked as a "release candidate" and isn't as battle-tested as v2, we believe it shouldn't have any major regressions compared to v2, so if it's possible, you might want to try it out (after this PR has been released, probably in the next rc). |
6255ec0
to
70f057a
Compare
This commit is quite important for our project, since we have to force a reload in production to support RTL languages, and we are seeing a high amount of crashes that I am hoping this should address. A backport to v2 would be ideal, but we can update our version to 3 if it includes this commit. When can we expect an RC cut with this? |
Hey @gp3gp3gp3, actually we plan to release 3.0.0 early next week 🤞 |
We are not able to upgrade to version 3 due to other dependencies which break with removal of _setGlobalConsole (mrousavy/react-native-vision-camera#1514). A patch to version 2 would be immensely appreciated. |
…e-mansion#3954) <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary Fixes software-mansion#3645 The reason for the crash when reloading was that, when the sensor listeners where cleaned up in the `AnimatedSensorModule`'s destructor, the `NativeProxy` object used for calling JNI functions has already been destroyed, causing a null pointer dereference. This PR moves the sensor listener cleanup to `NativeProxy`'s destructor, where JNI functions are still safe to call. <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> ## Test plan In the Example app: - go to the "Use Animated Sensor" example - trigger a reload (e.g. by typing "r" in metro) - 🤞 for no crash <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. -->
Summary
Fixes #3645
The reason for the crash when reloading was that, when the sensor listeners where cleaned up in the
AnimatedSensorModule
's destructor, theNativeProxy
object used for calling JNI functions has already been destroyed, causing a null pointer dereference.This PR moves the sensor listener cleanup to
NativeProxy
's destructor, where JNI functions are still safe to call.Test plan
In the Example app: