Closed Bug 728263 Opened 8 years ago Closed 8 years ago

Errors occur when Fennec is closed

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set

Tracking

()

VERIFIED FIXED
Firefox 13
Tracking Status
firefox12 --- affected
blocking-fennec1.0 --- beta+
fennec 13+ ---

People

(Reporter: xti, Assigned: gbrown)

Details

Attachments

(1 file, 1 obsolete file)

Firefox 13.0a1 (2012-02-17)
20120217031227
http://hg.mozilla.org/mozilla-central/rev/2271cb92cc05
Device: Motorola Droid PRO
OS: Android 2.3.3


Steps to reproduce:
1. Open Fennec
2. Go to Menu > More > Quit

Expected results:
After step 2, no errors should occur.

Actual result:
The following errors occur:

    02-17 17:00:42.018: E/ActivityThread(13964): Activity org.mozilla.fennec.App has leaked IntentReceiver android.accounts.AccountManager$12@40440540 that was originally registered here. Are you missing a call to unregisterReceiver()?
    02-17 17:00:42.018: E/ActivityThread(13964): android.app.IntentReceiverLeaked: Activity org.mozilla.fennec.App has leaked IntentReceiver android.accounts.AccountManager$12@40440540 that was originally registered here. Are you missing a call to unregisterReceiver()?
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:756)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:551)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:874)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:861)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:855)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.accounts.AccountManager.addOnAccountsUpdatedListener(AccountManager.java:1712)
    02-17 17:00:42.018: E/ActivityThread(13964):    at org.mozilla.gecko.AboutHomeContent.init(AboutHomeContent.java:142)
    02-17 17:00:42.018: E/ActivityThread(13964):    at org.mozilla.gecko.GeckoApp$AboutHomeRunnable.run(GeckoApp.java:1165)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.os.Handler.handleCallback(Handler.java:587)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.os.Handler.dispatchMessage(Handler.java:92)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.os.Looper.loop(Looper.java:123)
    02-17 17:00:42.018: E/ActivityThread(13964):    at android.app.ActivityThread.main(ActivityThread.java:3806)
    02-17 17:00:42.018: E/ActivityThread(13964):    at java.lang.reflect.Method.invokeNative(Native Method)
    02-17 17:00:42.018: E/ActivityThread(13964):    at java.lang.reflect.Method.invoke(Method.java:507)
    02-17 17:00:42.018: E/ActivityThread(13964):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    02-17 17:00:42.018: E/ActivityThread(13964):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    02-17 17:00:42.018: E/ActivityThread(13964):    at dalvik.system.NativeStart.main(Native Method)
    02-17 17:00:42.033: I/ActivityManager(1298): Process org.mozilla.fennec (pid 13964) has died. 

http://pastebin.mozilla.org/1486279
(In reply to Naoki Hirata :nhirata from comment #1)
> Do you have sync setup?

No, I used a clean profile for both Aurora and Nightly.
tracking-fennec: --- → ?
tracking-fennec: ? → 13+
blocking-fennec1.0: --- → beta+
You can easily reproduce this bug if you enable Android's "Developer options > Don't keep activities" setting.
Assignee: nobody → gbrown
android.accounts.AccountManager.addOnAccountsUpdatedListener is called from org.mozilla.gecko.AboutHomeContent.init(AboutHomeContent.java:142)

AccountManager.removeOnAccountsUpdatedListener is never called.

From the API doc for addOnAccountsUpdatedListener:

"As long as this listener is present, the AccountManager instance will not be garbage-collected, and neither will the Context used to retrieve it, which may be a large Activity instance. To avoid memory leaks, you must remove this listener before then. Normally listeners are added in an Activity or Service's onCreate(Bundle) and removed in onDestroy()."
Attachment #604087 - Flags: review?(mark.finkle)
Comment on attachment 604087 [details] [diff] [review]
patch to remove listener during onDestroy


>         unregisterReceiver(mBatteryReceiver);
>+        if (mAboutHomeContent != null) {
>+            mAboutHomeContent.onDestroy();
>+        }

nit: add a blank line above the new code
Attachment #604087 - Flags: review?(mark.finkle) → review+
updated for nit; r=mfinkle
Attachment #604087 - Attachment is obsolete: true
Attachment #604187 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b7dbbf933296
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 13
Verified/fixed on:
Nightly Fennec 15.0a1 (2012-04-25)
Device: HTC Desire (Android 2.2.2)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.