I have a problem that I am getting EX_BAD_ACCESS when calling release on an NSStream object in my dealloc on the iPhone.
The following code
- (void)dealloc {
DLog(@"dealloc started for: %@",self);
@synchronized(self) {
lookupCount--;
if (lookupCount==0) {
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
}
}
DLog(@"inStream retain count before release: %d",[inStream retainCount]);
[inStream release];
DLog(@"outStream retain count before release: %d",[outStream retainCount]);
[outStream release];
[queryToSend release];
[resultString release];
[data release];
[super dealloc];
NSLog(@"dealloc finsihed for : %@",self);
}
crashes with EX_BAD_ACCESS on the [outstream release]; line.
Log output is as follows
2009-04-29 13:16:28.547 App[30580:20b] -[SimpleQuery dealloc] [Line 160] dealloc started for: <SimpleQuery: 0x56e540>
2009-04-29 13:16:28.547 App[30580:20b] -[SimpleQuery dealloc] [Line 168] inStream retain count before release: 1
2009-04-29 13:16:28.548 App[30580:20b] -[SimpleQuery dealloc] [Line 170] outStream retain count before release: 1
Wondering if anyone has any ideas why this might be ?