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

Check if child view != null before dropping #20465

Closed
wants to merge 2 commits into from

Conversation

chrusart
Copy link
Contributor

Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.).

Fixes #20288

Test Plan:

No test plan, crashes happen rarely and very hard to reproduce.

Release Notes:

[ANDROID] [BUGFIX] [NativeViewHierarchyManager.java] - Fixes crash when trying to drop null child view

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@chrusart
Copy link
Contributor Author

CLA signed

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 31, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@xkrsz
Copy link

xkrsz commented Aug 1, 2018

This may resolve the crashes, but I think there's an underlying issue in Android 8.0 resulting in potentially broken UI.

@chrusart
Copy link
Contributor Author

chrusart commented Aug 3, 2018

You think it's an underlying issue in Android 8.0 because it happen only on this version? There is also a possibility that in 8 were some changes and RN didn't make adjustments for it.
But this check will not harm, right? Maybe in some future versions something else will break that this child will be null again. I'm not a fan of hiding/patching things, but to find the source of a problem as well. This check will resolve crashes, but will not make harder to find the real reason as it should make crashes or errors in more obvious place, this crash is probably just a side effect of a real problem.

@xkrsz
Copy link

xkrsz commented Aug 3, 2018

You’re right, that’s a more probable scenario.

I would suggest logging a warning if child == null, this should improve visibility of the root cause.

@chrusart
Copy link
Contributor Author

chrusart commented Aug 3, 2018

Log added.

@facebook-github-bot
Copy link
Contributor

@chrusart I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@chrusart
Copy link
Contributor Author

chrusart commented Sep 3, 2018

@mkonicek hi, just mention you to get reviewer for this PR as bot says :)
Can you review code? Not sure you work still for RN.

@chrusart
Copy link
Contributor Author

chrusart commented Sep 3, 2018

@hramos hi, is @mkonicek still working for facebook, who can do review now?

@chrusart
Copy link
Contributor Author

@hramos ?

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Sep 28, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

@chrusart merged commit af181fb into facebook:master.


Once this commit is added to a release, you will see the corresponding version tag below the description at af181fb. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 28, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 28, 2018
grabbou pushed a commit that referenced this pull request Oct 2, 2018
Summary:
Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.).

Fixes #20288
Pull Request resolved: #20465

Differential Revision: D10113976

Pulled By: hramos

fbshipit-source-id: 34f5654f3bdbc63eb7f7d0b5c94885576fc3cdcd
jstheoriginal pushed a commit to jstheoriginal/react-native that referenced this pull request Dec 14, 2018
Summary:
Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.).

Fixes facebook#20288
Pull Request resolved: facebook#20465

Differential Revision: D10113976

Pulled By: hramos

fbshipit-source-id: 34f5654f3bdbc63eb7f7d0b5c94885576fc3cdcd
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
Summary:
Fixes our top crash when framework try drop a view from parent, but it's a null (already removed etc.).

Fixes facebook#20288
Pull Request resolved: facebook#20465

Differential Revision: D10113976

Pulled By: hramos

fbshipit-source-id: 34f5654f3bdbc63eb7f7d0b5c94885576fc3cdcd
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants