Working on a Core Data document-based app. Executing the following AppleScript:
tell application "MyApp"
open POSIX file "/path/to/SomeDocument"
end tell
results in program receiving signal EXC_BAD_ACCESS here
#0 0x9113a2af in -[NSScriptCommand _sendToRemainingReceivers]
#1 0x9113ae8c in -[NSScriptCommand executeCommand]
#2 0x911541d1 in -[NSScriptingAppleEventHandler
handleCommandEvent:withReplyEvent:]
#3 0x9103d404 in -[NSAppleEventManager
dispatchRawAppleEvent:withRawReply:handlerRefCon:]
I dug into there with gdb and found, in that NSScriptCommand instance,
* evaluatedReceivers is an NSApplication instance.
* receiversSpecifier is null.
* direct parameter is an array containing a single object, an NSURL specifying
the document that I doubleclicked.
Doubleclicking this document, or any document, in Finder, works fine. I
thought that Finder essentially sends the same event as my AppleScript does.
I have not done anything in my code to implement the AppleScript 'open'
command. I'm just expecting the built-in behavior to work. My reading of
Cocoa Scripting Guide says that this command should result in invocation of
-[NSDocumentController openDocumentWithContentsOfURL:display:error:], but it
crashes before it gets there. I have overridden several of the
document-opening methods, but they would execute even later.
What might be going on here?
Thanks,
Jerry
_______________________________________________
Cocoa-dev mailing list ([email protected])
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]