Wow, Michael! I pasted in your code, rebuilt, and it worked perfectly. Thanks!

Since you made my day be being such a trooper, I decided to file a bug. Maybe we'll get this fixed someday.

Jerry

Problem ID: 7037206

Apple Event built with Bundle ID Tries Connect to previously-quit Process, Fails

Summary: If an application quits another application using an Apple Event that was built with a Bundle ID, then re-launches the other application, then tries to quit it again, the re-quit Apple Event message fails, apparently because it tries to connect to the process that had been previously quit.

Steps to Reproduce:

1. Build a Cocoa Tool using the code in the attached file AEDisconnectDemo.m. This tool is designed to repeatedly launch and then quit TextEdit.app Quitting is done by creating a Quit Apple Event using the bundle identifier of TextEdit.app. A new Apple Event is created with each launch/quit cycle.

2. Run the demo.

Expected Results:

It should launch TextEdit, sleep 5, quit TextEdit, sleep 5, then repeat this forever

Actual Results:

The second time it tries to quit TextEdit, AEMessageSend() returns a -609 Invalid Connection error and the operation fails. Apparently, it's trying to connect to the TextEdit process instance that it quit the first time.

Notes: In the code, if you then un-comment USE_PSN_INSTEAD_OF_BUNDLE_ID, rebuild, and re-run, it works as expected. (Thanks to Michael Nickerson!)
_______________________________________________

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 arch...@mail-archive.com

Reply via email to