Instagram / IGListKit

A data-driven UICollectionView framework for building fast and flexible lists.
https://instagram.github.io/IGListKit/
MIT License
12.84k stars 1.54k forks source link

Nested collection view crash when removing? #1373

Open danqing opened 4 years ago

danqing commented 4 years ago

New issue checklist

General information

I have a nested collection view using IGListKit. So the parent collection view has a few of its own cells and then one section (cell) that contains the child collection view.

I have it set up such that when the parent collection view encounters a loading error of some sort, it returns an empty objects ([]). But during loading the child collection view is already present (with some loading animations, etc.)

However, when I update the objects function to return [] in parent, I get the following crash:

request for number of items in section 9223372036854775807 when there are only 0 sections in the collection view

This only occurs when the child collection view is no longer in the view hierarchy (or the data hierarchy).

I'm not sure how IGListKit handles diffing or updating under the hood, and I also don't know where something like 9223372036854775807 can come up.. If I keep the child collection view around, everything works just fine. Is there any extra step I am missing when updating the parent collection view?

Thanks!

iperry90 commented 4 years ago

@danqing Would you be able to provide a sample project which reproduces the issue? If you could provide a link to a project, I can take a look.

danleechina commented 4 years ago

I had the same issue in Xcode 11.4 on iOS 13. The interesting thing is 9223372036854775807 is 0x7FFFFFFFFFFFFFFF, the biggest int for 64bit

aleksanderlorenc-lw commented 6 months ago

@danqing @danleechina Have you ever found a solution to this problem? We're getting this crash on iOS 17.x and can reproduce by reloading / removing views.