Closed Bug 923407 Opened 11 years ago Closed 11 years ago

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

Categories

(Firefox for Android Graveyard :: Awesomescreen, defect)

26 Branch
ARM
Android
defect
Not set
critical

Tracking

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

VERIFIED FIXED
Firefox 27
Tracking Status
firefox25 --- unaffected
firefox26 --- verified
firefox27 --- verified
fennec 26+ ---

People

(Reporter: u421692, Assigned: bnicholson)

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

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)
tracking-fennec: --- → ?
Thanks!
tracking-fennec: ? → 26+
Assignee: nobody → bnicholson
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+
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
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Attachment #815509 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
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
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: