Re: Odd crash-loading AppleScripts
Re: Odd crash-loading AppleScripts
- Subject: Re: Odd crash-loading AppleScripts
- From: email@hidden
- Date: Thu, 5 Mar 2009 13:09:26 +0100
In fact, even this simpler version will trip up GuardMalloc
-( void ) laodRunScript
{
NSDictionary *errors = nil;
NSString *fieldContent = @"Could not Load Script, See Logs";
NSAppleScript *script = [[ NSAppleScript alloc ]
initWithSource:@"return \"Hello World\""];
if ( script ){
NSAppleEventDescriptor* returnDescriptor = nil;
returnDescriptor = [ script executeAndReturnError: &errors ];
if ( !errors ){
fieldContent = [ NSString stringWithFormat:@"Message from script:
%@", [ returnDescriptor stringValue ]];
}
else{
NSLog( @"there was an error loading the script:%@", errors );
}
[script release];
}
else{
NSLog( @"there was an error loading the script:%@", errors );
}
[ textField_m setStringValue:fieldContent ];
}
On 5 Mar 2009, at 13:00, email@hidden wrote:
Reza,
I suspect this is not your fault. I suggest you file a radar bug.
BTW - You never release NSAppleScript *script, so this code would
leak.
and your spelling is as bad as ever :) 'laodRunScript'
Matt
On 5 Mar 2009, at 11:25, Reza Farhad wrote:
Has
Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was
creating the issue I made a little app to reproduce the problem.
This app Loads a simple "Hello World" script and displays it in a
window. Again if I have Guard Malloc on, it would crash the app,
but otherwise it seems to work. Here is a link to the test project
app, so others can have a look and see if they can get to the
bottom of this.
http://www.Qu-s.eu/Dev/AppleScriptLoader.zip
Thanks
Reza
On 4 Mar 2009, at 19:27, has wrote:
_______________________________________________
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
_______________________________________________
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