Last Comment Bug 774304 - java.lang.NullPointerException: at org.mozilla.gecko.MultiChoicePreference.onDialogClosed(MultiChoicePreference.java)
: java.lang.NullPointerException: at org.mozilla.gecko.MultiChoicePreference.on...
Status: VERIFIED FIXED
[native-crash]
: crash, regression
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: 15 Branch
: ARM Android
: -- critical (vote)
: Firefox 19
Assigned To: Brian Nicholson (:bnicholson) (PTO through August 1)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-16 08:56 PDT by Scoobidiver (away)
Modified: 2013-01-02 14:30 PST (History)
4 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
affected
verified
verified


Attachments
Make initialization of MultiChoicePreference synchronous (1.53 KB, patch)
2012-10-11 17:53 PDT, Brian Nicholson (:bnicholson) (PTO through August 1)
no flags Details | Diff | Splinter Review
Check for null pref values when closing MultiChoicePreference (1.16 KB, patch)
2012-10-18 11:12 PDT, Brian Nicholson (:bnicholson) (PTO through August 1)
mark.finkle: review+
lukasblakk+bugs: approval‑mozilla‑aurora+
lukasblakk+bugs: approval‑mozilla‑beta+
Details | Diff | Splinter Review

Description Scoobidiver (away) 2012-07-16 08:56:40 PDT
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 :Margaret Leibovic 2012-07-16 11:36:27 PDT
Looks like mPrevValues is null here:
http://hg.mozilla.org/releases/mozilla-aurora/annotate/tip/mobile/android/base/MultiChoicePreference.java#l165
Comment 2 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-11 17:53:47 PDT
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.
Comment 3 Mark Finkle (:mfinkle) (use needinfo?) 2012-10-18 06:49:51 PDT
(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?
Comment 4 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-18 11:12:13 PDT
Created attachment 672866 [details] [diff] [review]
Check for null pref values when closing MultiChoicePreference
Comment 5 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-18 12:29:20 PDT
http://hg.mozilla.org/integration/mozilla-inbound/rev/421315a62cb5
Comment 6 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-18 12:30:38 PDT
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
Comment 7 Ryan VanderMeulen [:RyanVM] 2012-10-18 18:37:41 PDT
https://hg.mozilla.org/mozilla-central/rev/421315a62cb5
Comment 8 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-22 11:43:18 PDT
http://hg.mozilla.org/releases/mozilla-aurora/rev/10a89f81cae9
Comment 9 Brian Nicholson (:bnicholson) (PTO through August 1) 2012-10-22 11:43:40 PDT
http://hg.mozilla.org/releases/mozilla-beta/rev/c1c29d889d3e
Comment 10 Kevin Brosnan [:kbrosnan] 2013-01-02 11:27:57 PST
No 17 or 18 crashes marking as verified.

Note You need to log in before you can comment on or make changes to this bug.