script scope variables inexplicably becoming unset

Dr. Hawkins dochawk at gmail.com
Tue Dec 30 13:20:02 EST 2014


I am having problems with script scope variables (declared local before any
handler) becoming unset, apparently within individual lines of handlers.

For example, the code
on shwChcStk
   ck "chstk: _" & chStk  & "_; " & cr & chStk is empty
   if chStk is empty then
      --debug only; this happens in the debugger.
      answer "chStk empty"
      breakpoint
      initCtr
   end if
   if the chcStk of me then
      lock messages --chStk becomes unset during openstack!
      palette chStk
      unlock messages
      set the width of chStk to the width of chFld

where ck is a logger:

on ck stuff
   --   answer stuff
   --   breakpoint
   put stuff
   put stuff & cr after fld "log" of stack "ckwatch"
end ck

First it oddly produces simply "false" as the output, rather than

_chStk_
false

If I comment out from &cr on it produces the first part.

In any event, it can get to "if chStk" is empty with a value for chStk,
open that stack as a pallete, and then have nothing in chStk or chFld  two
lines later.

But this isn't entirely predictable, either--if I remove the lock messages
around the palette command, ckStk gets emptied every time, even though
there is nothing in the  preOpenStack/OpenStack  handlers executes other
than  logging of the milliseconds to a global,  checks for whether it is
the main stack, and an exit.

And the weirdness continues.

In another section

  ck the selectedChunk

produced
    word 5 to 4 of field 11

the next line,

   put the selectedChunk into pos

put something like
   char 10000 to 100007 of field 1

Is the put statement into the message box or another field (of a closed
stack) changing the selectedChunk ???

THis is 7.0.1


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list