weird card deletion anomalies

Richard Gaskin ambassador at
Wed Sep 9 11:26:21 EDT 2009

Richard Gaskin wrote:
> Tereza Snyder wrote:
>> On Sep 9, 2009, at 9:16 AM, Richard Gaskin wrote:
>>> I'm rewriting my script editor to use multiple cards in a single  
>>> window rather than a separate window for each script.  The migration  
>>> has been going well, with one oddity:
>>> When I first set this up, I had the stack's closeStack handler  
>>> delete every card from #2 on:
>>>  go cd 1
>>>  repeat with i = 2 to the number of cds
>>>    delete cd 2
>>>  end repeat
>> Why not use "for i = the number of cds down to 2"? Seems cleaner to  
>> me. Though I know that the representation of cards in memory probably  
>> has nothing to do with card order, it feels to me that peeling them  
>> off the back would be cleaner than pulling them out of the middle.  
>> And, as is most likely, the cards were not shuffled after they were  
>> created, or inserted into the middle of the stack, it might actually  
>> be relevant to the crash. I admit that's a stretch, though.
> It may be a long shot, but if it helps pin it down it's worth trying. 
> Thanks for the suggestion.
> If it's related to the crash, however, it may raise a question about the 
> stability of reordering cards.
> We'll see....

I just tried the change to delete cards off the back on closeStack 
rather than "delete cd 2" - still crashed.  Once I removed that from 
closeStack and reinstated it in the preOpenStack handler it resumed 
reliable operation.

I guess the good news there is that reordering cards on the fly doesn't 
seem to have a problem. :)

  Richard Gaskin
  Fourth World
  Revolution training and consulting:
  Webzine for Rev developers:

More information about the Use-livecode mailing list