shutDownRequest ignored - yes, it -is- a reproducible bug - Workaround works!

Barry Levine themacguy at macosx.com
Sun Sep 7 13:05:00 EDT 2003


Thierry,

Thanks -very- much for your assistance. I added the same handler to the 
splash stack but, in each handler, added something to tell me which 
stack's handler was executing. As you've said, from the second time and 
beyond, the handler in the splash stack (the "engine") is executing 
while the other stack's handler is ignored. And it does appear that the 
addition of the handler to the "engine" stack is a good workaround.

(fine minutes later)

I just tried the solution on my "real" app and it works fine. I'll add 
to my bug report (#536).

I salute you! Thanks again.

Regards,
Barry

On Sunday, Sep 7, 2003, at 07:42 America/Denver, Thierry wrote:

> Date: Sun, 7 Sep 2003 15:03:57 +0200
> Subject: Re: shutDownRequest ignored - yes, it -is- a reproducible bug
> From: Thierry Arbellot <thierry.arbellot at wanadoo.fr>
> To: use-revolution at lists.runrev.com
> Reply-To: use-revolution at lists.runrev.com
>
> Barry,
>
> I have tried your example and I can make it work :
> I just added the shutdownRequest handler in BOTH stacks.
>
> The first time I select the "Quit" menu, the "shutdownRequest" message
> is sent to the "maintest" stack.
> But, from the 2nd time, the message is sent to the "splashtest" stack.
>
> Actually, it's a bug.
>
> The documentation says the "shutdownRequest" message is sent to the
> current stack, that is defined by the defaultStack property.
> The defaultStack property is always sets to "maintest".
> Then the "shutdownRequest" message should always be sent to the
> "maintest" stack.
>
> Hope it helps.
>
> Thierry
>
> On Sunday, September 7, 2003, at 07:56 AM, Barry Levine wrote:
>
>> Consider the following two handlers. Both allegedly will intercept the
>> "Quit" when selected from the OSX app menu. In both cases, with
>> multi-stack apps, either handler (I only use one or the other) will
>> only be executed the first time it is called.
>> ---------------------------------------------------------------
>> on shutDownRequest
>>    answer information "Are you sure you want to quit?" with "Quit" or
>> "Don't Quit" as sheet
>>    if it is "Quit" then pass shutDownRequest
>> end shutDownRequest
>> ---------------------------------------------------------------
>> on appleEvent theClass,theID
>>   if theClass is "aevt" and theID is "quit" then
>>     answer information "Are you sure you want to quit?" with "Quit" or
>> "Don't Quit" as sheet
>>     if it is "Quit" then pass appleEvent
>>   end if
>> end appleEvent
>> ---------------------------------------------------------------
>>
>> I can reproduce this "works only the first time" behavior. Here is how
>> I did it:
>>
>> 1. Create a stack. Let's call it "splashtest". Save it as
>> "splashtest.rev". Add this handler to the stack script:
>>
>> on openStack
>>   wait 2 seconds -- so we can see we're here
>>   hide this stack
>>   go stack "maintest.rev"
>> end openStack
>>
>> 2. Save and close the stack.
>>
>> 3. Now create that "maintest" stack and save it in a file named
>> "maintest.rev". Add this handler to the stack script:
>>
>> on shutDownRequest
>>   answer information "Quit?" with "Quit" or "Cancel"
>>   if it is "Quit" then pass shutDownRequest
>> end onShutDownRequest
>>
>> 4. Save and close the stack.
>>
>> 5. Create a Distribution using "splashtest.rev" as the main stack to
>> which the engine will be attached. Add "maintest.rev" to the
>> distribution, as well. Make sure you check the Answer Dialog
>> inclusion. Build it.
>>
>> 6. Run the app. Select "Quit" from the app menu. You'll get the
>> confirmation dialog. Click "Cancel" and the app will stay running.
>> Select "Quit" from the app menu again. The app will just quit.
>>
>> QED. This is an OSX bug. I have the stacks and the compiled app I can
>> eMail to anyone who is interested.
>>
>> Barry
>>
--------------------------------------------------------
Barry Jay Levine
"The Mac Guy"

Macintosh Troubleshooting, System Engineering, Training,
AppleShare/OSX Server Setup, System Upgrades and Enhancements,
Custom Programming for Mac/Windows/Linux/Solaris

On-Site service for K20, Business, Consumer

Phone/VoiceMail: 915-581-1105
             Fax: 915-581-8167
           eMail: themacguy at macosx.com
--------------------------------------------------------




More information about the use-livecode mailing list