Anomalous Script behavior

Peter Bogdanoff bogdanoff at
Wed Sep 23 16:49:32 EDT 2015


I am still wrestling with a bug in LC 7 (quoted below if you want to read—but not necessary). It’s very difficult to reproduce in a sample stack. LiveCode has offered to fix it with credits from the Business program. I do realize that there are long-term and short-term bugs in the IDE that people wish were fixed by the engineers as a matter of course of time . I wish this one was fixed, but it probably won’t be until I pay them to do it. But here, for my own mental health, is more information about the issue...

My application has trouble with LC 7 (any version) of it keeping track which stack it is in. I tell it to show a button; an error message says there is no button, even when there is. I discovered by doing simply:

if there is a button tButton then
	show button tButton
	put the short name of this stack
end if

that I was somehow in another stack at that moment—could be my substack, the Message Box, or RevPropertyPalette 1, even the Tools Palette, and there was of course, no button tButton  to show—even though my scripts were continuing to execute as expected. I put in a command to go to my stack to somehow force it to be there, but to no avail, that test kept saying "this stack" was another stack. The IDE is at times thinking that I’m in another stack when my scripts are functioning totally within my main stack. The problem seems to arise after going to one of these other stacks by clicking on them, or somehow unwittingly being in some IDE stack—from that point on that other stack keeps coming back until I quit and reopen.

I have no idea of how the IDE operates as far as keeping track of which stack is the stack-in-question. Making a simple sample stack to reproduce the problem didn’t show the issue. The problem didn’t show in earlier versions of LC. 

As I said, I’ve tried to force my way back to my stack, but the IDE seems to be in two worlds at the same time, my stack and this other stack, thus creating havoc.

Peter Bogdanoff

> This is the issue I was having with a stack with a player that sends callbacks that a script handler doesn’t seem to respond to… LiveCode 7.1.0 dp1
> An update. I was able to isolate the problem. SAVING the stack sets things aright, for awhile...
> This is how my script should work:
> 1. I load an audio file from a remote server into a player
> 2. I set the callbacks of the player
> 3. In my application (an image of music notation with button borders marking specific parts of the music notation) I’m setting the showBorder of a series of card buttons to true when a callback is received from the player. So, I set the showBorder of the first button to true, and start the player
> 3. The player sends the first callback and the script sets the showBorder of the first button to false and sets the showBorder of the second button to true. The player sends the second callback and the 2nd button border is set to false and the 3rd border is set to true, and so on with each subsequent callback.
> This works very nicely (for a while). Then I change the audio file in the player. Then things fail:
> 1. The player sends callbacks reliably, the handler is invoked to do the setting of the showBorders, but the lines in the script that set the showBorders are seemingly not performed. The first border is set (number 3 above), but the subsequent borders are not.
> 2. I isolated it down to an issue of these lines:
> 	set the showBorder of card button tPrevButton to false
> 	set the showBorder of card button tNextButton to true
> These buttons exist on the card, but the engine seems to not know about them. It neither turns the border off on the first or the border on on the second. There are no error warnings. In fact these lines SEEM to be skipped. So, I change the script to the following:
> 	if there is a card button tNextButton then
> 		set the showBorder of card button tNextButton to true
> 	else
> 		put “ERROR”
> 	end if
> I click APPLY in the editor. I start the player and get the ERROR.
> 3. Now I SAVE the stack and start the player and I get NO error. The SAVING of the stack seems to fix the problem. It application works great again as I play the same audio file.
> 4. I load another audio file in, the error returns. I save the stack and it starts working. In fact I can save the stack while the player is playing and the borders are not working, and as soon as the save is finished, the borders start to work properly. Doing a SAVE always works, APPLYING script changes does not.
> It’s a large stack, 179 MB, with over 3000 cards. The application has a total of 10 main stacks using 300 MB of memory that are loaded in. It worked in LC 6.1.3 and LC 6.7.7, but fails in LC 7.
> Memory issue???
> I filed a bug report, 15689.
> Peter Bogdanoff

More information about the Use-livecode mailing list