IllegalStateException calling requireContext in TranslationsDialogFragment
Categories
(Firefox for Android :: Translations, defect, P1)
Tracking
()
People
(Reporter: polly, Assigned: olivia)
References
()
Details
(Keywords: crash, regression, topcrash, Whiteboard: [fxdroid][foundation][translations:130])
Crash Data
Attachments
(1 file)
|
48 bytes,
text/x-phabricator-request
|
dmeehan
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-release+
|
Details | Review |
Spotted in crash telemetry. Stack trace is
Exception java.lang.IllegalStateException:
at androidx.fragment.app.Fragment.requireContext (Fragment.java:972)
at androidx.fragment.app.Fragment.getResources (Fragment.java:1036)
at org.mozilla.fenix.translations.TranslationsDialogFragment.onCreateDialog$lambda$1$lambda$0 (TranslationsDialogFragment.java:83)
at android.app.Dialog$ListenersHandler.handleMessage (Dialog.java:1501)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:224)
at android.os.Looper.loop (Looper.java:318)
at android.app.ActivityThread.main (ActivityThread.java:8772)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)
Updated•1 year ago
|
Updated•1 year ago
|
Comment 1•1 year ago
|
||
This TranslationsDialogFragment crash was a regression in Fx 126.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
Gabriel, do you have any insight into this bug? I'll try to figure out more too.
Updated•1 year ago
|
| Reporter | ||
Comment 3•1 year ago
|
||
Looks like we have had many previous similar issues from using requireContext().
It is likely to be difficult to reproduce but easy to fix.
I agree with Arturo's suggestion in this related crash: https://github.com/mozilla-mobile/fenix/issues/8408#issuecomment-585990538
Comment 4•1 year ago
|
||
I think we should use navigateSafe method when we open the TranslationsDialogFragment.
val directions =
BrowserFragmentDirections.actionBrowserFragmentToTranslationsDialogFragment()
navController.navigateSafe(R.id.browserFragment, directions)
In MenuNavigationMiddleware is used without navigateSafe like this :
is MenuAction.Navigate.Translate -> navController.nav(
R.id.menuDialogFragment,
MenuDialogFragmentDirections.actionMenuDialogFragmentToTranslationsDialogFragment(),
)
Maybe from here is the bug.
Comment 5•1 year ago
|
||
The bug is linked to a topcrash signature, which matches the following criterion:
- Top 10 AArch64 and ARM crashes on release
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 6•1 year ago
|
||
I'll work on a speculative fix today based on that information, thanks for the information and suggestions!
| Assignee | ||
Comment 7•1 year ago
|
||
Attempt to fix IllegalStateException in TranslationsDialogFragment.
- Added
navigateSafetoMenuNavigationMiddleware - Added
runIfFragmentIsAttachedto places wherefindNavController().popBackStack()was used in the translations area
Comment 9•1 year ago
|
||
| bugherder | ||
Comment 10•1 year ago
|
||
The patch landed in nightly and beta is affected.
:olivia, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox129towontfix.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 11•1 year ago
|
||
Comment on attachment 9412503 [details]
Bug 1907286 - IllegalStateException calling requireContext in TranslationsDialogFragment
Beta/Release Uplift Approval Request
- User impact if declined: More crashes in the Android translations area.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce: Not an easily tested code path to reproduce a crash.
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The change is not particularly risky because this patch only adds guard statements to prevent trying to get a
contextwhen one is not available. However, this patch is a speculative crash fix and cannot be easily tested. - String changes made/needed:
- Is Android affected?: Yes
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 12•1 year ago
|
||
Comment on attachment 9412503 [details]
Bug 1907286 - IllegalStateException calling requireContext in TranslationsDialogFragment
Approved for 129.0b5
Comment 13•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
| Assignee | ||
Comment 15•1 year ago
•
|
||
Comment on attachment 9412503 [details]
Bug 1907286 - IllegalStateException calling requireContext in TranslationsDialogFragment
Beta/Release Uplift Approval Request
- User impact if declined: More crashes in the Android translations area.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce: Not an easily tested code path to reproduce a crash.
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The change is not particularly risky because this patch only adds guard statements to prevent trying to get a
contextwhen one is not available. However, this patch is a speculative crash fix and cannot be easily tested. - String changes made/needed:
- Is Android affected?: Yes
Comment 16•1 year ago
|
||
Comment on attachment 9412503 [details]
Bug 1907286 - IllegalStateException calling requireContext in TranslationsDialogFragment
Approved for 128.0.2
Updated•1 year ago
|
Comment 17•1 year ago
|
||
| uplift | ||
Description
•