Closed JanC closed 12 years ago
Hi, I think there is a bug in the TITokenField#addToken method when the delegate discards the adding of a token.
- (TIToken *)addTokenWithTitle:(NSString *)title { if (title.length){ TIToken * token = [[TIToken alloc] initWithTitle:title representedObject:nil font:self.font]; [self addToken:token]; [token release]; return token; } return nil; }
If shouldAdd says NO, [self addToken:token] will not retain the token so we end up with a TiToken with 1 retain count and we release it. The it returns a released object which crashes.
This method should return an autoreleased object:
- (TIToken *)addTokenWithTitle:(NSString *)title { if (title.length){ TIToken * token = [[TIToken alloc] initWithTitle:title representedObject:nil font:self.font]; [self addToken:token]; return [token autorelease]; } return nil; }
cheers ;)
Hi, I think there is a bug in the TITokenField#addToken method when the delegate discards the adding of a token.
If shouldAdd says NO, [self addToken:token] will not retain the token so we end up with a TiToken with 1 retain count and we release it. The it returns a released object which crashes.
This method should return an autoreleased object:
cheers ;)