Sounds like you're using NSAppleScript from a non-main thread, which will result in random crashes like that. NSAppleScript is only designed to work from the main thread.

--
m-s

On 22 Apr, 2008, at 13:47, Steve Cronin wrote:
Folks;

I've seen some inconsistent behavior on AppleScript running under Leopard.

Here's an example:
...
        NSString *theScript =@"some valid dynamic script text"
        NSDictionary *errorDict = [NSDictionary dictionary];
NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: &errorDict];
...

will OCCASIONALLY crash at the NSAppleEventDescriptor specification:

#0      0x932c3d5c in getDescDataType
#1      0x932c7ab7 in aeCoerceDescInternal
#2      0x932cc055 in AECoerceDesc
#3      0x1d4a8150 in ComponentCoerceDesc
#4      0x1d48cbec in ASCompile
#5      0x903bacb8 in CallComponentFunction
#6      0x1d487ae2 in AppleScriptComponent
#7      0x1d4a3927 in AGenericManager::HandleOSACall
#8      0x903755cd in CallComponentDispatch
#9      0x953fc513 in OSACompile
#10     0x93e6edaf in -[NSAppleScript compileAndReturnError:]
#11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:]
#12     0x93e6ee51 in -[NSAppleScript executeAndReturnError:]

Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!)
Is a dual processor Intel creating a risk here?
Is there something better I can do to handle the error?
Why should I have to use a @try block here?
I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict.

It will crash only every so often....
My hunch is that crashes are more likely when machine is under load and memory swapping might be involved.
This is running on a 4G MacBook...

Any wisdom appreciated!
Steve
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san %40bungie.org

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to