Why AIR Applications Auto-Exit on Mac OS

A user on the Adobe AIR forums recently requested that we change the default behavior of AIR applications running on Mac OS so that they don’t exit when the last window is closed. This changed behavior would, of course, be consistent with the majority of Mac OS applications.

Contrary to what you might suspect, the current behavior was not an oversight on our part; nor was it a result of porting a Windows design to Mac OS. (We have several individuals on our team with significant Mac OS experience and I assure you they wouldn’t stand for that kind of thing.)

The decision makes more sense if you think about it in light of some observations about actual AIR application development:

  • Although the default behavior of Windows applications is to exit when all windows are closed, many developers want to write Windows applications that keep running in this case.
  • Although the default behavior of Mac OS applications is to keep running when all windows are closed, many developers want to write Mac OS applications that exit in this case.
  • An application running without windows open is often a stumbling block for developers coming up to speed on the platform because, when they try to launch the application again, nothing happens by default.

From this one can, I claim, reasonably conclude that defaulting to platform-specific behavior in this case is not worthwhile: most applications either want to keep running on all platforms or exit on all platforms. Second, to ease that developer stumbling block, the default had better be to exit. Thus, NativeApplication.autoExit defaults to “true” on Mac OS, Windows, and Linux.

Any chance we’ll change this in a future release? Not likely. Although patterns of development change, to insure forward compatibility we’d have to keep the current behavior for old applications and introduce the new behavior only for new applications. Even just the switch would introduce yet another thing for developers to learn—and another potential stumbling block. In practice the cost of changing an API’s behavior is quite high, and I don’t think this change would make the cut.