weird card deletion anomalies

Richard Gaskin ambassador at fourthworld.com
Wed Sep 9 11:21:44 EDT 2009


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....

>> This worked well enough, but I found that about half the time I  
>> saved the Rev engine would crash.  The file was fine - I can reopen  
>> it, edit anything easily, and even save it again.  But only after it  
>> creates multiple cards, about half the time it crashed during the  
>> save command, while half the time it saved just fine.  FWIW, the  
>> crash occured before the "~" copy was made, so it's something early  
>> on in the save routine.
>>
>> On a lark I move the card deletion from the closeStack handler to a  
>> preOpenStack handler.  Now it works fine all the time  - I can save  
>> without difficulty.
>>
>> Anyone else seen odd crashes during save?
> 
> Are you compacting the stack before saving?
> 
> Does it crash if, as a debugging measure,  you exit  before actually  
> saving? Then save in a separate call?

Sometimes I use a variant of MC's Save menu item, which does a compact, 
a brief pause, then a save, and other times I've used just the save 
command by itself.  I've noticed no difference between compacting and 
not compacting on this one.

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list