Crash in java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child''s parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java)

RESOLVED FIXED in Firefox 54

Status

()

defect
--
critical
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: maliu, Assigned: maliu)

Tracking

({crash})

51 Branch
Firefox 55
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox52 wontfix, firefox-esr52 unaffected, firefox53 wontfix, firefox54 fixed, firefox55 fixed)

Details

(crash signature)

Attachments

(1 attachment)

This bug was filed from the Socorro interface and is 
report bp-262e6399-5496-4556-86d8-12a952170409.
=============================================================

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
	at android.view.ViewGroup.addViewInner(ViewGroup.java:3881)
	at android.view.ViewGroup.addView(ViewGroup.java:3734)
	at android.support.v4.view.ViewPager.addView(Unknown Source)
	at android.view.ViewGroup.addView(ViewGroup.java:3679)
	at android.view.ViewGroup.addView(ViewGroup.java:3655)
	at org.mozilla.gecko.home.activitystream.topsites.TopSitesPagerAdapter.instantiateItem(TopSitesPagerAdapter.java:71)


Looks like we store views in pages list for reuse, not actually create a new instance every time.
Assignee: nobody → max
Status: NEW → ASSIGNED
Comment on attachment 8856439 [details]
Bug 1354973 - Remove view before add to new ViewGroup,

https://reviewboard.mozilla.org/r/128396/#review131974

Thanks for fixing this!

::: mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesPagerAdapter.java:72
(Diff revision 1)
> +        ViewParent viewParent = page.getParent();
> +        if (viewParent != null && viewParent instanceof ViewGroup) {
> +            ViewGroup viewGroup = (ViewGroup) viewParent;
> +            viewGroup.removeView(page);
> +        }

nit: final :)
Attachment #8856439 - Flags: review?(s.kaspari) → review+
Pushed by max@mxli.us:
https://hg.mozilla.org/integration/autoland/rev/9b66674b3b80
Remove view before add to new ViewGroup, r=sebastian
https://hg.mozilla.org/mozilla-central/rev/9b66674b3b80
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Goes back to Fx51 and bug 1293790 IIUC. Please request Aurora approval on this if I've got that right :)
Blocks: 1293790
Flags: needinfo?(max)
Version: unspecified → 51 Branch
Comment on attachment 8856439 [details]
Bug 1354973 - Remove view before add to new ViewGroup,

Approval Request Comment
[Feature/Bug causing the regression]: ActivityStream
[User impact if declined]: Random timing crash when TopSite refreshed
[Is this code covered by automated tests?]: No
[Has the fix been verified in Nightly?]:Yes
[Needs manual test from QE? If yes, steps to reproduce]: No
[List of other uplifts needed for the feature/fix]: No
[Is the change risky?]: No
[Why is the change risky/not risky?]: Trivial solution on the same thread and small function block
[String changes made/needed]: No
Flags: needinfo?(max)
Attachment #8856439 - Flags: approval-mozilla-aurora?
Comment on attachment 8856439 [details]
Bug 1354973 - Remove view before add to new ViewGroup,

Fix a crash. Aurora54+.
Attachment #8856439 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.