-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
refactor: improve logs related to deckPicker in StudyOptionsFragment #17291
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One blocker on the comment, rest are preferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will convert a crash that is the reason we saw this problem into a bunch of log warnings that we will never see
I think we should send an error report at least I think it should still be non-null, but, the getter is just returning All of the activity results should have an and configureToolbar shouldn't be run in onCreateView, it should probably run onAttach ? In those cases I don't think it's ever possible for Activity to be null (onAttach it will exist, and if !Added and you avoid, then you will avoid when it is not null) And if we somehow still attempt to fetch the deckPicker / activity then it will still crash so we'll see it |
31704b1
to
a106d82
Compare
a106d82
to
362fba7
Compare
config toolbar should not be in onAttach since,
|
Based on that description of the lifecycle, is it possible then that we are in a race with construction of view / configure of toolbar, and a teardown cycle with destroy of view / detach of fragment? If not, then I don't know how the activity could be null. Perhaps we need some logging on the teardown direction of the view/fragment lifecycle to see if we are still trying to configure a toolbar when the user has already moved on to something else and the fragment detached so there is no activity ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the changes, just left two minor style issues.
To be honest, this bug would probably be fixed by using the FragmentResult apis in the configureToolbarInternal() method to ping DeckPicker and let it handle the menu update itself. It's not the job of StudyOptionsFragment to handle the menu of its parent, directly accessing DeckPicker also makes it very hard to test the fragment separately from DeckPicker because any test needs to make sure that the DeckPicker is available or try weird mocking.
I have the same complaint about pushing the handling of those menu items that access directly DeckPicker(deck rename/delete/export) into StudyOptionsFragment.
362fba7
to
26f1393
Compare
@mikehardy awaiting your review |
@lukstbit just to note: the following issue/PR starts to move in this direction, and it'd be useful to transfer the additional thoughts from your comment here so they can be worked into the solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty thorough! There is a small chance acracrium will be bombed with this but somehow I don't think so - hopefully just enough to learn stuff
Thanks @criticalAY
Purpose / Description
Improvise the logs in StudyOptionsFragment to find the exact cause of NPE in study option fragment
Fixes
How Has This Been Tested?
Local build
Checklist
Please, go through these checks before submitting the PR.