Closed Bug 731963 Opened 8 years ago Closed 8 years ago

java.lang.NullPointerException: at org.mozilla.gecko.DoorHangerPopup.updatePopup(DoorHangerPopup.java)

Categories

(Firefox for Android :: General, defect, critical)

13 Branch
ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 13

People

(Reporter: scoobidiver, Assigned: Margaret)

Details

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

Crash Data

Attachments

(1 file)

There's only one crash so far: bp-51374743-fbfe-4e1e-aa5d-638d32120229

java.lang.NullPointerException
	at org.mozilla.gecko.DoorHangerPopup.updatePopup(DoorHangerPopup.java:136)
	at org.mozilla.gecko.Tabs$2.run(Tabs.java:138)
	at android.os.Handler.handleCallback(Handler.java:605)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:137)
	at org.mozilla.gecko.GeckoApp$35.run(GeckoApp.java:1798)
	at android.os.Handler.handleCallback(Handler.java:605)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4340)
	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.DoorHangerPopup.updatePopup%28DoorHangerPopup.java%29
Whiteboard: [native-crash]
Assignee: nobody → margaret.leibovic
This seems kind of weird. It means that mContent is null here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/DoorHangerPopup.java#136

But if we got there, doorHangers.size() must be greater than 0 here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/DoorHangerPopup.java#130

And the only way to add a doorHanger to that array is through addDoorHanger here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/DoorHangerPopup.java#83

And that should ensure that init() gets called and mContent wouldn't be null in that case.

We could add some mContent null check in here, but I'd rather find out how this is happening. (And it would also be nice if this code was easier to follow.)
I guess updatePopup() is getting called before addPopup().
The fix is to remove this,
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/DoorHangerPopup.java#87

And call the init() in GeckoApp's initialize() just like how BrowserToolbar.init() happens.

That should fix this.

(This lazy initialization was done before lazy initialize() was added in GeckoApp. heh)
Attached patch band-aid patchSplinter Review
I really want to clean up the add/update logic here so that we never get into a mysterious state, but first I want to write tests (bug 732212).

I think we should keep init() out of GeckoApp if we can to avoid inflating the layout earlier than we need to, so this patch is just a band-aid that would prevent this crash. I don't really like it, but hopefully it can go away when I finish these tests/clean-up.
Attachment #602172 - Flags: review?(sriram)
Comment on attachment 602172 [details] [diff] [review]
band-aid patch

Looks good to me.
Attachment #602172 - Flags: review?(sriram) → review+
https://hg.mozilla.org/mozilla-central/rev/09799386e12d
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 13
Crash Signature: [@ java.lang.NullPointerException: at org.mozilla.gecko.DoorHangerPopup.updatePopup(DoorHangerPopup.java) ] → [@ java.lang.NullPointerException: at org.mozilla.gecko.DoorHangerPopup.updatePopup(DoorHangerPopup.java) ] [@ java.lang.NullPointerException: at org.mozilla.gecko.DoorHangerPopup.updatePopup(DoorHangerPopup.java) ]
tracking-fennec: ? → ---
You need to log in before you can comment on or make changes to this bug.