escoz / QuickDialog

QuickDialog - Quick and easy dialog screens for iOS
http://escoz.com/open-source/quickdialog
Other
3.07k stars 637 forks source link

bug introduced in showHideSections (fix provided) #654

Open rspreen opened 10 years ago

rspreen commented 10 years ago

In the Feb 21 commit ("Major Fixes to QD"), a bug was introduced in QuickDialogController+Animations.m, showHideSectionWithInsertAnimation...

The actual call to the table view to do the inserts of the "shown" sections has been moved inside the loop where these sections' indexes are collected into the "idx" indexSet. The intent is to collect all the inserted sections indexes inside the loop, and then insert them into the TableView all at once when that's done.

However, by moving the "insertSections" call inside the loop, it gets called repeatedly! This will work fine if there is only a single section to be added, but if there are multiple, the sections will be added repeatedly, leading to a TableView assertion failure, "NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections".

This bug exists in both loops of the method (both the delete and the insert loops), and the same 2 problems exist in the showHideElements... method.