Closed
Bug 1449569
Opened 7 years ago
Closed 7 years ago
Crash in java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference at android.view.inputmethod.BaseInputConnection.<init>(BaseInputConnection.java)
Categories
(GeckoView :: General, defect, P2)
Tracking
(firefox59 wontfix, firefox60 wontfix, firefox61 fixed)
RESOLVED
FIXED
mozilla61
People
(Reporter: philipp, Assigned: jchen)
References
Details
Crash Data
Attachments
(3 files)
This bug was filed from the Socorro interface and is
report bp-f5c19902-e80e-489f-9f6a-aaaf70180323.
=============================================================
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference
at android.view.inputmethod.BaseInputConnection.<init>(BaseInputConnection.java:71)
at org.mozilla.gecko.GeckoInputConnection.<init>(GeckoInputConnection.java:101)
at org.mozilla.gecko.GeckoInputConnection.create(GeckoInputConnection.java:94)
at org.mozilla.gecko.TextInputController.ensureInputConnection(TextInputController.java:147)
at org.mozilla.gecko.TextInputController.onCreateInputConnection(TextInputController.java:192)
at org.mozilla.gecko.GeckoView.onCreateInputConnection(GeckoView.java:378)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1280)
at android.view.inputmethod.InputMethodManager.onPostWindowFocus(InputMethodManager.java:1608)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4131)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7390)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:926)
=============================================================
crash reports with this signature start regressing since firefox 59 - probably related to bug 1416918.
perhaps the comment to this report gives a clue what's going on/how to reproduce:
"If Firefox has focus when switching users, switching back again results in a crash. "
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8966823 [details]
Bug 1449569 - 1. Move key event handling to GeckoEditable;
https://reviewboard.mozilla.org/r/235502/#review241380
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java:867
(Diff revision 1)
> +
> + final KeyListener keyListener = TextKeyListener.getInstance();
> + event = translateKey(event.getKeyCode(), event);
> +
> + // We only let TextKeyListener do UI things on the UI thread.
> + final View v = ThreadUtils.isOnUiThread() ? view : null;
Please avoid using single-char variable names.
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java:934
(Diff revision 1)
> }
>
> + private boolean shouldSkipKeyListener(final int keyCode, final @NonNull KeyEvent event) {
> + // Preserve enter and tab keys for the browser
> + if (keyCode == KeyEvent.KEYCODE_ENTER ||
> + keyCode == KeyEvent.KEYCODE_TAB) {
Indentation.
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java:940
(Diff revision 1)
> + return true;
> + }
> + // BaseKeyListener returns false even if it handled these keys for us,
> + // so we skip the key listener entirely and handle these ourselves
> + if (keyCode == KeyEvent.KEYCODE_DEL ||
> + keyCode == KeyEvent.KEYCODE_FORWARD_DEL) {
Indentation.
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java:1740
(Diff revision 1)
> + }
> + }
> + return true;
> + }
> +
> + while ((repeatCount--) != 0) {
Maybe > 0 is safer to avoid blocking on bad input.
Attachment #8966823 -
Flags: review?(esawin) → review+
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8966824 [details]
Bug 1449569 - 2. Don't force-create GeckoInputConnection;
https://reviewboard.mozilla.org/r/235504/#review241386
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java:178
(Diff revision 1)
> *
> * @param attrs EditorInfo instance to be filled on return.
> * @return InputConnection instance or null if input method is not active.
> */
> - public @Nullable InputConnection onCreateInputConnection(final @NonNull EditorInfo attrs) {
> + public synchronized @Nullable InputConnection onCreateInputConnection(
> + final @NonNull EditorInfo attrs) {
I actually prefer the 3-way indentation for non-aligned method arguments, can we agree on that style and enforce it?
Attachment #8966824 -
Flags: review?(esawin) → review+
Comment 7•7 years ago
|
||
I investigated this issue and I have found a speculative fix for this.
Assignee: nchen → andrei.a.lazar
Flags: needinfo?(andrei.a.lazar)
Updated•7 years ago
|
Flags: needinfo?(andrei.a.lazar) → needinfo?(nchen)
Attachment #8966957 -
Flags: review?(sdaswani) → review?(michael.l.comella)
Assignee | ||
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8966957 [details]
Bug 1449569 - Use current input session view instead of passing a null value.
https://reviewboard.mozilla.org/r/235642/#review241498
Thanks for the patch, though I'm not sure it would work.
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java:152
(Diff revision 1)
> if (!mQueue.isReady()) {
> return false;
> }
>
> if (mInputConnection == null) {
> - mInputConnection = GeckoInputConnection.create(mSession,
> + mInputConnection = GeckoInputConnection.create(mSession, mEditable);
Inside `GeckoInputConnection.create`, `session.getTextInput().getView()` will return null because `mInputConnection` is null. So the behavior is the same as before.
Assignee | ||
Updated•7 years ago
|
Flags: needinfo?(nchen)
Attachment #8966957 -
Flags: review?(michael.l.comella)
Assignee | ||
Updated•7 years ago
|
Assignee: andrei.a.lazar → nchen
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 11•7 years ago
|
||
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3401d063be3f
1. Move key event handling to GeckoEditable; r=esawin
https://hg.mozilla.org/integration/autoland/rev/1376d3c78039
2. Don't force-create GeckoInputConnection; r=esawin
Comment 12•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3401d063be3f
https://hg.mozilla.org/mozilla-central/rev/1376d3c78039
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Comment 13•7 years ago
|
||
Sadly, it would appear this missed the boat for possible uplift to Fx60.
Updated•6 years ago
|
Product: Firefox for Android → GeckoView
Updated•6 years ago
|
Version: Firefox 59 → 59 Branch
Updated•6 years ago
|
Keywords: crash,
regression
Target Milestone: Firefox 61 → mozilla61
You need to log in
before you can comment on or make changes to this bug.
Description
•