Closed Bug 774304 Opened 9 years ago Closed 9 years ago

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

Categories

(Firefox for Android Graveyard :: General, defect)

15 Branch
ARM
Android
defect
Not set
critical

Tracking

(firefox16 affected, firefox17 verified, firefox18 verified)

VERIFIED FIXED
Firefox 19
Tracking Status
firefox16 --- affected
firefox17 --- verified
firefox18 --- verified

People

(Reporter: scoobidiver, Assigned: bnicholson)

Details

(Keywords: crash, regression, Whiteboard: [native-crash])

Crash Data

Attachments

(1 file, 1 obsolete file)

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
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?
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+
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?
https://hg.mozilla.org/mozilla-central/rev/421315a62cb5
Status: ASSIGNED → RESOLVED
Closed: 9 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+
No 17 or 18 crashes marking as verified.
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.