Quitting standalone, is this a bug?

Michael Binder runr at prismpole.com
Thu May 17 12:21:57 EDT 2007


Hi everyone,

This is my first post to this list.  I'm new to Rev (but much hypercard 
experience).  I have just spent a couple of days figuring something out 
(it may be a bug) so I thought I'd share it.  I am developing with 
Studio 2.81 and testing on an mac ibook G4 running 10.3.9.

To demonstrate the bug:
Step 1) create a new main stack and call it "myApp".
Step 2) Put this handler into the stack script:

   on shutdownrequest
      answer "This stack: "& the name of this stack &cr& "Quit now?" 
with "Yes" or "No"
      if it is "Yes" then pass shutdownrequest
   end shutdownrequest

Step 3) Save myApp, and then save it as a mac OS X standalone.
Step 4) Launch the standalone.
Step 5) Quit (by menu or commandkey Q) and choose "No".  (the behavior 
is as expected)
Step 6) Quit again.  This time the bug is evident...

On my system, the second (and all subsequent) quit brings up a dialog 
box with an unexpected result: This stack: stack "answer dialog"

I discovered this bug in myBigComplexApp, and the bug there is a bit 
different.  The first time I quit myBigComplexApp, "This stack" is 
"revExternalLibrary".  On the second and all subsequent quits "this 
stack" is "answer dialog". (as in the example above)

This is a problem for me because when a user quits myBigComplexApp I 
need to validate data and offer the user a chance to save the changes.  
In order to do this I need to determine what data entry card the user 
is viewing when the quit request occurs:

    on shutdownrequest  -- this does not work as expected because of the 
bug
       if the short name of this cd is "dataEntry1" then
         validateData1
       else if the short name of this cd is "dataEntry2" then
         validateData2
       end if
       offerChanceToSave
    end shutdownrequest

My workaround for the bug is as follows:

    on shutdownrequest
       put line 1 of the recentcards of stack "myBigComplexApp" into 
whichcard
       if the short name of whichcard is "dataEntry1" then
         validateData1
       else if the short name of whichcard is "dataEntry2" then
         validateData2
       end if
       offerChanceToSave
    end shutdownrequest

I am not all that confident in my workaround because I am not confident 
that I understand the nature of the bug.  As I mentioned above, the bug 
in (simple) myApp is a bit different than in myBigComplexApp.

Do any of you have any thoughts on whether this is a bug, whether it 
occurs on other platforms, and whether my workaround could be improved?

thanks, in advance, for your responses
--Michael Binder




More information about the use-livecode mailing list