Note that there are some explanatory texts on larger screens.

plurals
  1. PONSZombie - should retain/release calls be paired by library?
    text
    copied!<p>TL:DR version: I used NSZombieEnabled to find source of EXC_BAD_ACCESS error and saw a library has 1 more release than retains. Can I assume that this library is causing the crash or can that release be associated with a retain from another library?</p> <p>I am having some problems in my app with a UITableViewCell subclass instance getting messages after its retain count reaches 0. I ran the app with NSZombies and am currently trying to pair the retain/release calls to find where exactly is the error originating from. I noticed that there are only 2 retains and 3 releases with "Responsible Library" set to QuartzCore. Does it mean that that extra release call is the one that causes my app to crash? Or is it possible that a release has associated retain in another library?</p> <p>Additional info: My section headers are tappable, when one is selected, the row for this section is inserted into table view and any previously visible row is deleted. In other words, there can be only 1 section at a time that has 1 row, all other sections must have 0 rows.</p> <p>The release/retain calls from QuartzCore that I paired are:</p> <pre><code>CALayer layoutSublayers (retains) CA::Layer::layout_if_needed(CA::Transaction*) (releases) </code></pre> <p>The release without a pair is:</p> <pre><code>CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) </code></pre> <p>The exact line where I get the crash is the endUpdates line in:</p> <pre><code>- (void)sectionHeaderView:(SectionHeaderView *)sectionHeaderView sectionOpened:(NSInteger)sectionOpened { SectionInfo *sectionInfo = [self.sectionInfoArray objectAtIndex:sectionOpened]; sectionInfo.open = YES; NSMutableArray *indexPathsToInsert = [[NSMutableArray alloc] init]; [indexPathsToInsert addObject:[NSIndexPath indexPathForRow:0 inSection:sectionOpened]]; /* Create an array containing the index paths of the rows to delete: These correspond to the rows for each quotation in the previously-open section, if there was one. */ NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init]; NSInteger previousOpenSectionIndex = self.openSectionIndex; if (previousOpenSectionIndex != NSNotFound) { SectionInfo *previousOpenSection = [self.sectionInfoArray objectAtIndex:previousOpenSectionIndex]; previousOpenSection.open = NO; previousOpenSection.category.model = nil; [previousOpenSection.headerView toggleOpenWithUserAction:NO]; [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:0 inSection:previousOpenSectionIndex]]; } // Style the animation so that there's a smooth flow in either direction. UITableViewRowAnimation insertAnimation; UITableViewRowAnimation deleteAnimation; if (previousOpenSectionIndex == NSNotFound || sectionOpened &lt; previousOpenSectionIndex) { insertAnimation = UITableViewRowAnimationTop; deleteAnimation = UITableViewRowAnimationBottom; } else { insertAnimation = UITableViewRowAnimationBottom; deleteAnimation = UITableViewRowAnimationTop; } NSIndexPath *indexToDelete = [indexPathsToDelete firstObject], *indexToInsert = [indexPathsToInsert firstObject]; if (indexToDelete == nil) { NSLog(@"no row to delete"); } else { NSLog(@"deleting row %d section %d", [indexToDelete row], [indexToDelete section]); } NSLog(@"inserting row %d section %d", [indexToInsert row], [indexToInsert section]); // Apply the updates. [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:insertAnimation]; [self.tableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation]; [self.tableView endUpdates]; // this is the crash. self.openSectionIndex = sectionOpened; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:sectionOpened] atScrollPosition:UITableViewScrollPositionNone animated:YES]; } </code></pre> <p>The error happens on iOS7.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload