You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.viewModels = [self.dataSource sectionController:self viewModelsForObject:object];
result = IGListDiff(oldViewModels, self.viewModels, IGListDiffEquality);
if self.viewModels is a NSMutableArray and just removeAllObjects and change the all value, result = IGListDiff(oldViewModels, self.viewModels, IGListDiffEquality); is NOT right
so i think , oldViewModels need copy the self.viewModels([self.viewModels copy]) or self.viewModels's property replaces strong with copy.
and i think another updateAnimated have same BUG maybe
The text was updated successfully, but these errors were encountered:
Thanks for investigating @YasinZhou! We deduplicate the models returned from the data source, so even if a mutable array is returned, it should be totally safe.
You made me double check everything though, and I did come across this, and you're right that if the data source returns an NSMutableArray, they could mutate the array and corrupt the models stored inside the binding section controller.
That'd be a really easy and useful fix if you want to submit a PR!
@rnystrom I decided to take care of this. However, I'm not sure if this is something we need to write a test for. I don't think we need to write one for this change. Any thoughts on this?
IGListBindingSectionController.m
and late
if
self.viewModels
is a NSMutableArray and just removeAllObjects and change the all value,result = IGListDiff(oldViewModels, self.viewModels, IGListDiffEquality);
is NOT rightso i think , oldViewModels need copy the self.viewModels([self.viewModels copy]) or self.viewModels's property replaces strong with copy.
and i think another
updateAnimated
have same BUG maybeThe text was updated successfully, but these errors were encountered: