Why does 'delete stack' sometimes not work?
Graham Samuel
livfoss at mac.com
Wed Oct 19 11:37:54 EDT 2016
I am still going on about how to reliably execute ‘close stack and delete from memory’ via script. I’m using LC8.1.1 rc2 on a Mac. The latest pickle I’ve got into is this:
I have a stack “myMainStack”, which has quite a few substacks - they’re palettes which user can open to access tools etc. All of them have their ‘cantDelete’ property set to false. I have a menu which includes an item for resetting the program, which involves deleting the stack “myMainStack” both in RAM and on disk, and then reloading it from a file in the program’s resources folder. In the IDE, I invoke this menu item and step through until it executes:
close stack “myMainStack”
Then the actual mainstack’s window closes. Those palettes which were open stay open. I have a feeling that the whole thing should close (this is an option I chose for the mainstack - ‘purge stack on close’, ‘purge window on close'), but never mind, that’s what happens.
If I then execute
delete stack “myMainStack”
from the message box, I get
> Message execution error:
>
> Error description: Object: stack locked, or object's script is executing
>
> Hint: button "File" of group “mytMenu" of card “MainDisplay" of stack "/Users/Graham/Library/Application Support/PointPlots/myMainStack.livecode"
>
>
As the stack is closed, it can’t be executing scripts: it’s not locked in that its ‘cantDelete’ property is set to false. Furthermore the file mentioned in the error message isn’t there, because my program deliberately deleted it earlier in the script. So this error makes no sense, but why should it be an error at all? The engine ought to be pointing at the stack in RAM, not on disk - the Project Browser says it’s there still.
Trying to test this with a simple mainstack with one palette substack does not exhibit the problem.
This apparently simple requirement is driving me crazy.
TIA for any help.
Graham
More information about the use-livecode
mailing list