Problem: 1327574

Title: (Quitting) MacApp.Test - Failure on AppleEvents and Quit

Received: Feb 27 1996 1:51PM


I am having yet another problem with MacApp 3.3. I am getting a failure when quitting my application. I tracked it down to problems sending Apple Events to itself. While debugging MacApp I found a couple of problems. They occur when a hidden window is open and you attempt to quit the application. The first occurs when the title of the window is not defined (ie empty string). When it handles the Apple Event to close the window, it fails when you call AEResolve from within ResolveObjectSpecifier. This doesn't seem to cause any problems other than the error messages. The seconds occurs when the title is defined. For some reason it thinks the Apple Event says to close the application and not the window. This results in another TQuitCommand being processed within the first. What happends is the Apple Event is never created correctly because the window is hidden and the result of MakeObjectSpecifier is not checked.

A way to fix this might be to have "ghost" windows as well as documents. Another fix might be to add another condition to the record Boolean in TQuitCommand::CloseAWindow. For example:

Boolean record = !fRespondingToAE
                        && (gClipboardMgr->fClipWindow != aWindow)
                        && aWindow->IsShown();
I also don't like the way ghost documents are omitted from the close procedure when the application quits. This forces users to make their document scriptable.
Fix:

UApplication.cp: Changed TQuitCommand::CloseAWindow so that the command created is not recordable if the window is not shown.