Return to problem list

ID: 6001460

URL: rdar://problem/6001460

Title: LSUIElement/LSBackgroundOnly bad applicationShouldTerminate logout behavior

Originated Date: 11-Jun-2008

State: Open

Fixed? No

Attachments: ApplicationShouldTerminate.zip

Description:

Summary: (I apologize for the vague title, but I ran into the character length limit.) The problem occurs when you specify LSUIElement 1 or LSBackgroundOnly 1 in the Info.plist of your Cocoa app. When the user attempts to logout, the NSApplication delegate method -applicationShouldTerminate: is called, but the return value is ignored. For example, if the method returns NSTerminateCancel, logout still occurs. Steps to Reproduce: (1) Unzip, open, build, and run the attached sample Xcode project ApplicationShouldTerminate. (2) Attempt to logout (for example, from the Apple menu or with command-shift-q). Expected Results: I'm not sure what the proper behavior should be, but I don't expect both (1) applicationShouldTerminate: is called and (2) the return value is ignored. Either the delegate method should not be called at all for LSUIElement and LSBackgroundOnly apps, or the return value should be respected. (In any case, the behavior needs to be documented.) Actual Results: The method applicationShouldTerminate: is called and returns NSTerminateCancel, but logout occurs anyway. Regression: This problem occurs in both Leopard and Tiger. The problem also occurs if you change LSUIElement to LSBackgroundOnly in the Info.plist for the ApplicationShouldTerminate sample project. Notes: For a normal Cocoa application (not LSUIElement or LSBackgroundOnly), returning NSTerminateCancel from applicationShouldTerminate: results in logout being aborted, and the user sees an alert window with a message such as "The application ApplicationShouldTerminate canceled logout."

Return to problem list