Quitting standalone, is this a bug?

J. Landman Gay jacque at hyperactivesw.com
Fri May 18 16:34:26 EDT 2007


Michael Binder wrote:
> Hi everyone,
> after another round of research I have found that I am not the first to
> stumble on this bug....

Oops, I believe you now. ;) Sorry about all the long, tangential 
explanations.

I just did some tests and there is something weird going on. If a second 
answer dialog is executed immediately after the first, subsequent lines 
of code in my handler do not execute. What's odd, however, is that the 
"pass shutdownrequest" line at the very end of the handler *does* run -- 
but that seems to be the only thing.

To test, I created a new stack containing a single field. In the stack 
script, I put a single handler:

on shutdownrequest
   put the defaultstack & cr after fld 1
   answer "Quit?" with "Yes" or "No"
   put it into tChoice
   put "Test line is executing" & cr after fld 1
   if tChoice = "no" then
     put the defaultstack & cr after fld 1
   else
     pass shutdownrequest
   end if
end shutdownrequest

I created a standalone from this stack. The first time I try to quit 
(choosing "No" from the dialog), all lines execute. I see:

  stack "quitTest"
  Test line is executing
  stack "quitTest"


If I immediately try to quit again, I see nothing, no new lines are 
added to the field. I know the shutdownrequest message is being sent 
because the dialog appears, and if I choose "Yes" the app quits, which 
means it is being passed. But the commands in between do anything.

If I set the defaultstack specifically after the answer dialog:

on shutdownrequest
   put the defaultstack & cr after fld 1
   answer "Quit?" with "Yes" or "No"
   put it into tChoice
   set the defaultstack to "quitTest" -- ADDED THIS
   put "Test line is executing" & cr after fld 1
   if tChoice = "no" then
     put the defaultstack & cr after fld 1
   else
     pass shutdownrequest
   end if
end shutdownrequest

The problem is resolved, all lines execute, and you can run the handler 
repeatedly without any problem. It looks like an engine bug to me; the 
engine appears to lose track of the defaultstack after two repeated 
answer dialogs. It probably hasn't been noticed very often because so 
many other user actions will reset the defaultstack automatically, at 
which point the engine "knows" once again what it is.

Gotta thank Michael for being stubborn about this. Good catch.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list