0
votes

I could use a little help on this one. I narrowed the crash source down to NSMutableArray viewControllers by commenting out the release statement in dealloc.

Code:

NSMutableArray *controllers = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < self.numSlides; i++) {
    [controllers addObject:[NSNull null]];
}

self.viewControllers = controllers;
[controllers release];

// Later on in dealloc:
[viewControllers release], viewControllers = nil;

In the main.m file [ int retVal = UIApplicationMain(argc, argv, nil, nil); ] we get: Program received signal: "EXC_BAD_ACCESS"

When I comment out the release for viewControllers -> no crash but memory leak.

Are you out there Obi-Wan - you are our last hope.

Thanks in advance for the help.

1

1 Answers

0
votes

The code you posted looks fine; without seeing any of the rest of it, I’d guess that your viewControllers property is declared as assign rather than retain. If that isn’t it, try running the static analyzer (Product > Analyze or Cmd-Shift-B); it can usually catch that kind of problem.