IGListKit icon indicating copy to clipboard operation
IGListKit copied to clipboard

Unequal objects IGListBindingSectionController crash

Open shial4 opened this issue 6 years ago • 2 comments

New issue checklist

  • [X ] I have reviewed the README and documentation
  • [ X] I have searched existing issues and this is not a duplicate
  • [ X] I have attempted to reproduce the issue with our production app.

General information

  • IGListKit version: 3.4.0
  • iOS version(s): 13.2.1
  • CocoaPods version: 1.8.3
  • Xcode version: 11.2.1
  • Devices/Simulators affected: device
  • Reproducible in the demo project? (Yes/No):
  • Related issues:

Debug information

We have crash on IGAssert when section controller updates child sublist objects. I assume the row (cell) was reused and before update due to it was reused for different place have different number of objects. How to prevent it?

Place where it crashes is in IGListBindingSectionController during didUpdateToObject: section controller contains oldObject.

- (void)didUpdateToObject:(id)object {
    id oldObject = self.object;
    self.object = object;

    if (oldObject == nil) {
        self.viewModels = [[self.dataSource sectionController:self viewModelsForObject:object] copy];
    } else {
        IGAssert([oldObject isEqualToDiffableObject:object],
                 @"Unequal objects %@ and %@ will cause IGListBindingSectionController to reload the entire section",
                 oldObject, object);
        [self updateAnimated:YES completion:nil];
    }
}

The crash happens when I navigate in stack far enough for the UIKit to release objects. Then I go back and the time when I pop to the controller it crashes.

shial4 avatar Nov 19 '19 02:11 shial4

@shial4 would you be able to provide a sample project that reproduces the crash?

iperry90 avatar Nov 19 '19 15:11 iperry90

@shial4 would you be able to provide a sample project that reproduces the crash?

Hopefully, yes. Will see over the weekend what can I do about it. I can reproduce it with our production app. There is a chance :)

shial4 avatar Nov 19 '19 21:11 shial4