Re: NSAppleScript crash on executeAndReturnError
Re: NSAppleScript crash on executeAndReturnError
- Subject: Re: NSAppleScript crash on executeAndReturnError
- From: Charles Srstka <email@hidden>
- Date: Sun, 28 Nov 2004 19:22:41 -0600
On Nov 28, 2004, at 6:51 PM, James J. Merkel wrote:
On Nov 28, 2004, at 1:51 PM, Charles Srstka wrote:
On which line is it crashing?
It crashes on:
finderComment = [[theScript executeAndReturnError: &theError]
stringValue];
That can't be, since if it were crashing here, it wouldn't be getting
far enough to run your NSLog displaying the error message.
No matter, I just tried it with the code sample you posted, and it was
crashing while popping the autorelease pool. After a little
experimentation, I've found that the problem seems to be stemming from
this line:
[theError release];
The reason is that -[NSAppleScript executeAndReturnError:(NSDictionary
**)theError] returns an autoreleased dictionary in the theError
variable. So, get rid of that release statement, and also change this
line:
NSDictionary *theError = [[NSDictionary alloc] init];
to this:
NSDictionary *theError = nil;
to avoid a memory leak.
Charles
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden