Closed Bug 1039471 Opened 5 years ago Closed 5 years ago

crash in java.lang.IllegalStateException: Fragment RecentTabsPanel{422715c0} not attached to Activity at android.support.v4.app.Fragment.getLoaderManager(Fragment.java)

Categories

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

33 Branch
ARM
Android
defect
Not set
critical

Tracking

()

VERIFIED FIXED
Firefox 33
Tracking Status
firefox33 --- verified
fennec 33+ ---

People

(Reporter: TeoVermesan, Assigned: lucasr)

References

Details

(Keywords: crash, regression, reproducible)

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is 
report bp-a680a97d-6f67-4cee-b694-8fb002140716.
=============================================================

Steps to reproduce:
1. Install pocket-panel, goal.com

Expected result:
- Feeds appear in about:home

Actual result:
- Firefox crashes.
Note: 
- not reproducible with instagram, wikipedia, home-feeds.

Stacktrace:
java.lang.IllegalStateException: Fragment RecentTabsPanel{422715c0} not attached to Activity
	at android.support.v4.app.Fragment.getLoaderManager(Fragment.java:863)
	at org.mozilla.gecko.home.RecentTabsPanel$3.run(RecentTabsPanel.java:253)
	at android.os.Handler.handleCallback(Handler.java:733)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5001)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
	at dalvik.system.NativeStart.main(Native Method)
Margaret, is this fallout from bug 1004850?
tracking-fennec: --- → ?
Looks like a Gecko message is received after the fragment has been detached. Teodora, is this bug reproducible every time you install pocket-panel or goal.com?
Attachment #8456869 - Flags: review?(margaret.leibovic)
Assignee: nobody → lucasr.at.mozilla
Yes, I install goal.com, firefox crashes, after that I go to about:addons and uninstall it, then try once again to install and firefox crashes again.
Doh, this looks like a regression from bug 1035439.
Blocks: 1035439
Comment on attachment 8456869 [details] [diff] [review]
Only restart loader if RecentTabsPanel is still attached (r=margaret)

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

::: mobile/android/base/home/RecentTabsPanel.java
@@ +250,5 @@
>                  mClosedTabs = closedTabs;
>  
> +                // The fragment might have been detached before this code
> +                // runs in the UI thread.
> +                if (getActivity() != null) {

Should we check canLoad() instead? That's what we used to do but changed here:
https://hg.mozilla.org/mozilla-central/rev/81c71f117c6a
Attachment #8456869 - Flags: review?(margaret.leibovic) → review+
(In reply to :Margaret Leibovic from comment #6)
> Should we check canLoad() instead? That's what we used to do but changed
> here:
> https://hg.mozilla.org/mozilla-central/rev/81c71f117c6a

There was a reason it was removed in bug 1035439; see https://bugzilla.mozilla.org/show_bug.cgi?id=1035439#c11. We still need to refresh the Recent Tabs panel with these STR, which were broken on Nightly before that bug:
1) Open about:home
2) Open a new tab for a different URL (e.g., google.com)
3) Select the tab from step 1
4) Go to the Recent Tabs panel (to load it), then go to another panel (to keep the Recent Tabs panel active, but hidden)
5) Close the tab in step 2, without selecting it
6) Go to the Recent Tabs panel again

canLoad() checks the fragment's visibility, which I don't think is something we should check in this case. We want to update the Recent Tabs panel regardless of whether we see it.
Duplicate of this bug: 1038866
tracking-fennec: ? → 33+
I stumbled over this (race condition?) using the debugger to investigate Bug 1038354; nice to see the fix is already in.
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/12a593a3681d
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 33
After installing pocket-panel and goal.com, feeds appear in about:home, so:
Verified fixed on:
Device: LG Nexus 4 
OS: Android 4.4.2
Build: Firefox for Android 33.0a1 (2014-07-20)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.