Can't delete a stack

Graham Samuel livfoss at mac.com
Sat Mar 23 17:18:21 CDT 2013


I seem (almost) to have found a solution: I put a button in the permanent stack (the one with the destruction handler in it) which directly invokes this handler, so there is no involvement from the stack that I want to delete. Bingo, it worked, but of course I (the user) had to click the button, which would be no good in a real life situation. So I put a line of script in the data stack that simply clicks at the loc of this button. I'm reminded of those little machines of my youth whose sole function was to turn themselves off (a hand emerged from the interior and flicked the 'off' switch, leaving enough time for the hand to go back inside before the motor stopped - it appealed to a certain mindset).

This cannot be the approved way to do this, but it does look as if it's working!

Graham

I wrote:
> Thanks, Pierre
> 
> This seems a good idea - it's true I put the 'delete' stuff in another stack, but the destruction routine was called from a handler in the (data) stack I'm trying to delete, so you could say the message path in the data stack was still involved and in that sense there was a currently executing handler. In effect I need a 'go' statement which will take all handler execution away from my data stack. So far I have tried a 'send' to the destruction routine in the other stack but that hasn't worked. I guess I may be able to use the other stack to detect whether the data stack needs deleting or not, which should mean that the data stack really isn't executing any handler when the test is made. One might summarise this as a rule "a stack can't delete itself". 
> 
> I will continue to experiment, but I'm still looking for ideas.
> 
> Thanks again
> 
> Graham
> 
> On 23 Mar 2013, at 20:02, Pierre Sahores wrote:
> 
>> from the dictionary entry for "Delete" :
>> 
>> Important!  You cannot delete the object whose script holds a currently executing handler.
>> 
>> Can makes thing confusing in some cases ;-)
>> 
>> Le 23 mars 2013 à 19:34, Graham Samuel a écrit :
>> 
>>> Sadly, exactly the same thing. If the IDE can purge a stack, why can't I? Maybe the delete command fires some other handler I don't know about. I will try to reduce the thing to a very simple test. I'm using LC 5.5.4 on a Mac, by the way.
>>> 
>>> Graham
>>> 
>>> On 23 Mar 2013, at 18:54, dunbarx at aol.com wrote:
>>> 
>>>> Graham.
>>>> 
>>>> 
>>>> Without digging into this at all, what happens if you delete the file last?
>>>> 
>>>> 
>>>> Craig Newman
>>>> 
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Graham Samuel <livfoss at mac.com>
>>>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>>>> Sent: Sat, Mar 23, 2013 1:28 pm
>>>> Subject: Can't delete a stack
>>>> 
>>>> 
>>>> I've got a stack that I want to purge in the way the IDE does. At the time of 
>>>> execution of the script below, the stack is in memory with a copy of it in a 
>>>> file (the path is in a global 'gDataStackPath'. I want to destroy both. Part of 
>>>> my script looks like this:
>>>> 
>>>> try
>>>>   if there is a file gDataStackPath then
>>>>      delete file gDataStackPath
>>>>      set the cantDelete of stack "myData" to false
>>>>      set the destroyStack of stack "myData" to true
>>>>      set the destroyWindow of stack "myData" to true
>>>>      delete stack "myData" -- this should remove it from memory
>>>> 
>>>> This deletes the file as expected, and the IDE shows that the stack is still in 
>>>> memory, but the script crashes on the 'delete stack..' line. The error is 361 
>>>> "can't set this property".
>>>> 
>>>> What did I do wrong?
>>>> 
>>>> TIA
>>>> 
>>>> Graham
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>>>> preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> --
>> Pierre Sahores
>> mobile : 06 03 95 77 70
>> www.sahores-conseil.com
>> 
>> 
>> 



More information about the use-livecode mailing list