Why does releasing this array cause a crash?
Why does releasing this array cause a crash?
- Subject: Why does releasing this array cause a crash?
- From: James Cicenia <email@hidden>
- Date: Tue, 10 Mar 2009 17:35:30 -0500
Hello
I am confused on this one:
In my method I have a local array:
NSMutableArray *arraySubType = [[NSMutableArray alloc]init];
Then in a loop from the database I have:
while (sqlite3_step(statement) == SQLITE_ROW) {
if(![aDict objectForKey: [NSString stringWithUTF8String:(char
*)sqlite3_column_text(statement, 1)]]){
NSMutableArray *tmpArray = [[NSMutableArray alloc]init];
[aDict setValue:tmpArray forKey: [NSString stringWithUTF8String:(char
*)sqlite3_column_text(statement, 1)]];
[tmpArray release];
}
arraySubType = [aDict objectForKey: [NSString stringWithUTF8String:
(char *)sqlite3_column_text(statement, 1)]];
[arraySubType addObject: [NSString stringWithUTF8String:(char
*)sqlite3_column_text(statement, 0)]]
[aDict setValue:arraySubType forKey: [NSString stringWithUTF8String:
(char *)sqlite3_column_text(statement, 1)]];
}
Shouldn't I now release arraySubType ??
If I do, later on I get a crash, if I don't I get no crash.
Thanks
James Cicenia
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden