weird card deletion anomalies

Tereza Snyder tereza at califex.com
Wed Sep 9 10:32:39 EDT 2009


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.

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

just some thoughts,

t


-- 
Tereza Snyder
Califex Software, Inc.
<www.califexsoftware.com>







More information about the use-livecode mailing list