Closed Bug 1112228 Opened 7 years ago Closed 7 years ago

TabTrayController can get out of sync with TabManager

Categories

(Firefox for iOS :: Browser, defect)

All
iOS 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bnicholson, Assigned: bnicholson)

References

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
st3fan
: review+
Details | Review
I'm still not quite used to Swift's copy-on-write behavior for arrays, and there are several bugs in TabTrayController that can cause the tabs arrays to get out-of-sync between the delegate and the data source. I got halfway there by using inout in the initializers, but then they end up getting copied immediately after that when the initializer assigns them [1]. That means the tabs arrays in the delegate/data source are still copies -- not references -- to the arrays given to them, so when the data source changes the array [2], that change isn't reflected in the delegate array.

[1] https://github.com/mozilla/firefox-ios/blob/bdedf9ed54fa4ffdf2e696704019d379ef244fa1/Client/Frontend/Browser/TabTrayController.swift#L84
[2] https://github.com/mozilla/firefox-ios/blob/bdedf9ed54fa4ffdf2e696704019d379ef244fa1/Client/Frontend/Browser/TabTrayController.swift#L102
Attached file Pull request
Attachment #8537340 - Flags: review?(sarentz)
Comment on attachment 8537340 [details] [review]
Pull request

This looks good to me.
Attachment #8537340 - Flags: review?(sarentz) → review+
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.