Closed Bug 808027 Opened 8 years ago Closed 8 years ago

java.lang.NullPointerException: at org.mozilla.gecko.Favicons$1.sizeOf(Favicons.java)

Categories

(Firefox for Android :: General, defect)

19 Branch
ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 19

People

(Reporter: scoobidiver, Assigned: lucasr)

References

Details

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

Crash Data

Attachments

(1 file)

It has been hit by one user twice, e.g. bp-fde9e8e0-46b2-4512-988f-d40012121102, and might be a regression from bug 785945.

java.lang.NullPointerException
	at org.mozilla.gecko.Favicons$1.sizeOf(Favicons.java:151)
	at org.mozilla.gecko.Favicons$1.sizeOf(Favicons.java:147)
	at org.mozilla.gecko.util.LruCache.safeSizeOf(LruCache.java:230)
	at org.mozilla.gecko.util.LruCache.put(LruCache.java:123)
	at org.mozilla.gecko.Favicons.putFaviconInMemCache(Favicons.java:213)
	at org.mozilla.gecko.Favicons.dispatchResult(Favicons.java:167)
	at org.mozilla.gecko.Favicons.access$500(Favicons.java:41)
	at org.mozilla.gecko.Favicons$LoadFaviconTask.onPostExecute(Favicons.java:387)
	at org.mozilla.gecko.Favicons$LoadFaviconTask.onPostExecute(Favicons.java:257)
	at android.os.AsyncTask.finish(AsyncTask.java:631)
	at android.os.AsyncTask.access$600(AsyncTask.java:177)
	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4745)
	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:786)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
	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.Favicons%241.sizeOf%28Favicons.java%29
Regression from bug 785945. Fixing.
Assignee: nobody → lucasr.at.mozilla
Blocks: 785945
Keywords: regression
Version: Trunk → Firefox 19
This bug is caused by something that has always bugged me: the fact that all our favicon handling is done in terms of Drawables instead of bitmaps. This creates an extra layer of interaction that is just inefficient (we create a layer around the image bitmaps that is not always useful) and prone to bugs (we cast Drawable to BitmapDrawable in places where this is not guaranteed to be valid).

This bug is caused by the case when the bitmap held by the drawable is discarded somehow. This is usually not a problem if the Drawable is used in views but, in the case of our mem cache, this *is* problematic. If the Drawable held by the cache is discarded, the Drawable will remain in the cache and might cause tons of empty cache entry after some time as its size would "0" (from a caching perspective).

Our favicon handling should all be done in terms of Bitmaps instead. This is safer, more flexible and more efficient.

I submitted this patch to try: https://tbpl.mozilla.org/?tree=Try&rev=6d2e8517879e
Attachment #677823 - Flags: review?(mark.finkle)
Attachment #677823 - Attachment is patch: true
Attachment #677823 - Flags: review?(mark.finkle) → review+
(In reply to Lucas Rocha (:lucasr) from comment #2)
> views but, in the case of our mem cache, this *is* problematic. If the
> Drawable held by the cache is discarded, the Drawable will remain in the
> cache and might cause tons of empty cache entry after some time as its size
> would "0" (from a caching perspective).

I actually meant "If the Bitmap held by the Drawable is discarded for some reason".
https://hg.mozilla.org/mozilla-central/rev/a519a3f18f39
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
Depends on: 813546
Depends on: 822686
You need to log in before you can comment on or make changes to this bug.