crash in java.lang.NullPointerException: at org.mozilla.gecko.home.BrowserSearch$SearchAdapter.getCount(BrowserSearch.java)

VERIFIED FIXED in Firefox 26

Status

()

Firefox for Android
Awesomescreen
--
critical
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: u421692, Assigned: bnicholson)

Tracking

({crash})

26 Branch
Firefox 27
ARM
Android
crash
Points:
---

Firefox Tracking Flags

(firefox25 unaffected, firefox26 verified, firefox27 verified, fennec26+)

Details

(crash signature)

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
This bug was filed from the Socorro interface and is 
report bp-0f12f681-548a-49ef-8252-e76882131003.
=============================================================
Crash found while performing monkey testing (http://developer.android.com/tools/help/monkey.html). It may be a click on an element that was not displayed yet, but logging issue for investigation.

Environment:
Device: HTC Desire HD (Android 2.3.5)
Build: Firefox Aurora 26.0a2 (2013-10-02)

Java Stack Trace 	

java.lang.NullPointerException
	at org.mozilla.gecko.home.BrowserSearch$SearchAdapter.getCount(BrowserSearch.java:723)
	at android.widget.AbsListView$PerformClick.run(AbsListView.java:1828)
	at android.os.Handler.handleCallback(Handler.java:587)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:150)
	at android.app.ActivityThread.main(ActivityThread.java:4385)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:507)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
	at dalvik.system.NativeStart.main(Native Method)

Updated

5 years ago
tracking-fennec: --- → ?

Comment 1

5 years ago
Thanks!
tracking-fennec: ? → 26+
Assignee: nobody → bnicholson
(Assignee)

Comment 2

5 years ago
Created attachment 815509 [details] [diff] [review]
Set list adapter to null when destroying BrowserSearch view

AbsListView#PerformClick is a runnable posted to handle ListView clicks, and it's possible that it won't be processed until after onDestroy(). When PerformClick#run runs, it does a number of sanity checks to make sure everything is still valid, including a call to adapter.getCount(): http://androidxref.com/2.3.6/xref/frameworks/base/core/java/android/widget/AbsListView.java#1811

Since we've called onDestroyView and set mList to null, we should also disassociate mList from its adapter to prevent these phantom events. This will make PerformClick#run bail on the 'adapter != null' check (line 1809 in the file linked above).
Attachment #815509 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 815509 [details] [diff] [review]
Set list adapter to null when destroying BrowserSearch view

Review of attachment 815509 [details] [diff] [review]:
-----------------------------------------------------------------

Nice catch.
Attachment #815509 - Flags: review?(lucasr.at.mozilla) → review+
(Assignee)

Comment 4

5 years ago
https://hg.mozilla.org/integration/fx-team/rev/211c60b0c91b
status-firefox25: --- → unaffected
status-firefox26: --- → affected
status-firefox27: --- → fixed
(Assignee)

Comment 5

5 years ago
Comment on attachment 815509 [details] [diff] [review]
Set list adapter to null when destroying BrowserSearch view

[Approval Request Comment]
Bug caused by (feature/regressing bug #): new-about-home
User impact if declined: possible NPE
Testing completed (on m-c, etc.): none
Risk to taking this patch (and alternatives if risky): Very low risk; just adds one extra line of cleanup.
String or IDL/UUID changes made by this patch: none
Attachment #815509 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/211c60b0c91b
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Attachment #815509 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
(Reporter)

Comment 8

5 years ago
Verified as fixed performing monkey testing (http://developer.android.com/tools/help/monkey.html).

Environment:
Device: HTC Desire HD (Android 2.3.5)
Build: Firefox Nightly 27.0a1 (2013-10-14) / Firefox Aurora 26.0a2 (2013-10-15)
Status: RESOLVED → VERIFIED
status-firefox26: fixed → verified
status-firefox27: fixed → verified
You need to log in before you can comment on or make changes to this bug.