These three lines in createNewTask: cause the issue:
NSString *string = [[NSString alloc] init];
string = [textField stringValue];
...
[string release];// With this, I've got an "exec_BAD_ACCESS" error
when calling three times in a row createNewTask with the same string in
textField
The first line sets 'string' to a retained, empty string object. The
next line sets 'string' to the object returned by [textField
stringValue], leaking the previous string object (its address was
forgotten while it was still retained). 'String' then points to an
object that wasn't retained by your code, so sending it a release
message will cause it to deallocate while it's still referenced
elsewhere (segfaulting if it's accessed after that).
You can fix the issue by removing the first & third lines
(empty-string allocation, release call), and moving the 'string' var
definition to the second line: