When closed, does a substack whose destroyStack is true remains in memory ?

Richard Gaskin ambassador at fourthworld.com
Thu Mar 23 08:03:38 EST 2006

Ken Ray wrote:
> Well, as I mentioned above, closed substacks are still in memory if the
> mainstack is, so you could check for the mainstack in "the windows" or in
> "the stacks" to see if it is in memory.


The windows function is documented only to return a list of open stacks. 
  The stacks function would seem to be the better one for testing if 
closed stacks are in memory, but it appears to behave anomalously and 
may not be reliable at this time.

Try this:

1. Make a new mainstack named "AAA"; save it
2. Make a substack in that stack file named "BBB"; save it
3. Get "the stacks"
RESULT: two entries for the filename to "AAA" are in the list,
as we would expect.

4. Set the destroyStack of "AAA" to true
5. Close "AAA"
6. Get "the stacks"
RESULT: the filename of "AAA" is in the list once, since BBB is still 
open; so far so good

7. Close "BBB";
    because BBB has its destroyStack to false it should
    still be in memory, but -
8. get "the stacks"
RESULT: the filename of "AAA" is not in the list


If the description for destroyStack is correct, "BBB" should still be in 
memory even if it's not open:

     If the destroyStack is false, closing a stack's window
     leaves it in memory.

For the stacks function, the dictionary says:

     The list includes any open Revolution windows (such as
     the message box and menu bar). It also includes stacks
     that have been opened during the current session and
     then closed, unless the stack's destroyStack property
     is set to true.

If I change the order so that the mainstack "AAA" has its destroyStack 
set to false and the substack "BBB" has its destroyStack set to true, I 
get the same result -- no entry in "the stacks" even though "AAA" is 
(according to the docs) still in memory.

What am I missing?  In my head this doesn't add up.

  Richard Gaskin
  Managing Editor, revJournal
  Rev tips, tutorials and more: http://www.revJournal.com

More information about the Use-livecode mailing list