Closing a stack and deleting it too

Graham Samuel livfoss at mac.com
Fri Oct 21 04:46:55 EDT 2016


I seem to be getting unreliable results from ‘close stack’. I note that the dictionary says:

> If the handler that closes the stack is in the script of the stack (or in the script of an object in the stack) and the stack's destroyStack <> property <> is true, the stack window <> is closed immediately, but the stack is not removed from memory until after the handler  <>completes.

I find that if I have a stack with a lot of substacks, on executing ‘close stack’, just the mainstack closes, despite the despite having ‘purge stack on close’ and ‘purge window on close’ set in the main and all the substacks. 

If this command worked as I imagined, it would not be necessary, or indeed appropriate, to follow it with a ‘delete stack’ command.

I think this failure to work as expected must be to do with message still waiting to finish, as suggested by the Dictionary entry - it’s probably a ‘menuPick’ handler, which is the only bit of script actually executing in the stack-to-be-deleted - but in my case apparently it never finishes. Is there a way of purging the message queue so that the ‘close’ command always does ‘delete’ as well?

If only I understood what ‘Close and Remove from Memory’ in the IDE actually does. I’ve been trying to find out for ages.

Graham


More information about the use-livecode mailing list