Presentation Remote, Apple Events, and Snow Leopard

We’ve recently been receiving email from some customers having problems with Presentation Remote under Mac OS X 10.6 (“Snow Leopard”). It was tricky to track down the cause for various reasons, including the fact that problems typically don’t even start to appear until you’ve been giving a presentation for about 20 minutes or so — the exact timing varies as it depends on how you’re using Presentation Remote.

It turns out, the problem is a bug in Snow Leopard itself. For detailed technical information, there’s an article on TidBITS that explains precisely what Apple broke in Snow Leopard, but here’s the quick version, along with how it affects us:

  • Many Mac applications support an Apple technology called AppleEvents. An AppleEvent is a kind of message sent from one application to another.
  • Presentation Manager (the Mac application that Presentation Remote talks to) uses AppleEvents to both control Keynote, and find out information such as which slide of the presentation you are on. Every time you change slides, every time you open or close a presentation, Presentation Manager sends and receives AppleEvents. It also a handful on a regular basis just to keep an eye on Keynote, so that it can “keep up” with what’s going on.
  • Apple introduced a bug in Snow Leopard where 1 out of every 65,536 AppleEvents fail: The message gets sent, but the reply is lost — worse still, it sits there for more than 60 seconds waiting for the lost reply, before giving up.
  • The effect on Presentation Manager was that communications between it and Keynote would “lock up” for over a minute and then, because the AppleEvent failed, it could end up with an incorrect result for whichever piece of information it was asking Keynote for, which could then cause problems.

Fixing It

The article I linked to above suggested that Apple would be fixing their bug in an update to Snow Leopard, OS X 10.6.2, at which point everything should function perfectly again.

But the 10.6.2 update arrived, and there was no fix. Perhaps in 10.6.3? In the meantime, we’ve released an update to Presentation Manager that makes two changes that will keep your presentations on an even keel:

  • If a reply is lost, we force it to give up after about 5 seconds.
  • When a reply is lost, Presentation Manager should ignore the result and quickly try again to get the real answer.