Re: Sending launch and quit Apple Events: Crazy Connection Errors
Re: Sending launch and quit Apple Events: Crazy Connection Errors
- Subject: Re: Sending launch and quit Apple Events: Crazy Connection Errors
- From: Jerry Krinock <email@hidden>
- Date: Tue, 7 Jul 2009 10:00:00 -0700
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 (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