java.lang.NullPointerException: at org.mozilla.gecko.MultiChoicePreference.onDialogClosed(MultiChoicePreference.java)

VERIFIED FIXED in Firefox 17

Status

()

Firefox for Android
General
--
critical
VERIFIED FIXED
5 years ago
4 years ago

People

(Reporter: Scoobidiver (away), Assigned: bnicholson)

Tracking

({crash, regression})

15 Branch
Firefox 19
ARM
Android
crash, regression
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(firefox16 affected, firefox17 verified, firefox18 verified)

Details

(Whiteboard: [native-crash], crash signature)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
There are two crashes in 15.0a2, including: bp-231d0ef1-0f4a-41c4-a2dc-e2efc2120716.

java.lang.NullPointerException
	at org.mozilla.gecko.MultiChoicePreference.onDialogClosed(MultiChoicePreference.java:165)
	at org.mozilla.gecko.PrivateDataPreference.onDialogClosed(PrivateDataPreference.java:34)
	at android.preference.DialogPreference.onDismiss(DialogPreference.java:381)
	at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1259)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:4945)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
	at dalvik.system.NativeStart.main(Native Method)

More reports at:
https://crash-stats.mozilla.com/report/list?signature=java.lang.NullPointerException%3A+at+org.mozilla.gecko.MultiChoicePreference.onDialogClosed%28MultiChoicePreference.java%29

Comment 1

5 years ago
Looks like mPrevValues is null here:
http://hg.mozilla.org/releases/mozilla-aurora/annotate/tip/mobile/android/base/MultiChoicePreference.java#l165
(Assignee)

Comment 2

5 years ago
Created attachment 670642 [details] [diff] [review]
Make initialization of MultiChoicePreference synchronous

This is likely happening because onDialogClosed() is getting called before the Runnable in loadPersistedValues() is run - and that's where we do the initialization. I think I threw this part in a handler to avoid a StrictMode violation, but this is probably one of those cases where we can just ignore it. There's not much we can do on the UI thread anyway until we've loaded the persistent prefs.
Assignee: nobody → bnicholson
Status: NEW → ASSIGNED
Attachment #670642 - Flags: review?(mark.finkle)
(In reply to Brian Nicholson (:bnicholson) from comment #2)
> Created attachment 670642 [details] [diff] [review]
> Make initialization of MultiChoicePreference synchronous
> 
> This is likely happening because onDialogClosed() is getting called before
> the Runnable in loadPersistedValues() is run

So the dialog is being closed before the initialization is complete? I don't like using a sync pref load. We try to avoid that whenever possible. In this case, the sync load would affect all users.

Could we protect onDialogClosed with some null checks?
(Assignee)

Comment 4

5 years ago
Created attachment 672866 [details] [diff] [review]
Check for null pref values when closing MultiChoicePreference
Attachment #670642 - Attachment is obsolete: true
Attachment #670642 - Flags: review?(mark.finkle)
Attachment #672866 - Flags: review?(mark.finkle)
Attachment #672866 - Flags: review?(mark.finkle) → review+
(Assignee)

Comment 5

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/421315a62cb5
(Assignee)

Comment 6

5 years ago
Comment on attachment 672866 [details] [diff] [review]
Check for null pref values when closing MultiChoicePreference

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 
User impact if declined: potential crashes
Testing completed (on m-c, etc.): just landed m-i
Risk to taking this patch (and alternatives if risky): very low risk (just null pointer check)
String or UUID changes made by this patch: none
Attachment #672866 - Flags: approval-mozilla-beta?
Attachment #672866 - Flags: approval-mozilla-aurora?
(Assignee)

Updated

5 years ago
status-firefox16: --- → affected
status-firefox17: --- → affected
status-firefox18: --- → affected
https://hg.mozilla.org/mozilla-central/rev/421315a62cb5
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
Attachment #672866 - Flags: approval-mozilla-beta?
Attachment #672866 - Flags: approval-mozilla-beta+
Attachment #672866 - Flags: approval-mozilla-aurora?
Attachment #672866 - Flags: approval-mozilla-aurora+
(Assignee)

Comment 8

5 years ago
http://hg.mozilla.org/releases/mozilla-aurora/rev/10a89f81cae9
status-firefox18: affected → fixed
(Assignee)

Comment 9

5 years ago
http://hg.mozilla.org/releases/mozilla-beta/rev/c1c29d889d3e
status-firefox17: affected → fixed
No 17 or 18 crashes marking as verified.
Status: RESOLVED → VERIFIED
status-firefox17: fixed → verified
status-firefox18: fixed → verified
You need to log in before you can comment on or make changes to this bug.