On Wed, Sep 28, 2011 at 07:13:43AM +1300, Ralph Versteegen wrote:
> On 27 September 2011 18:27, James Paige <[email protected]> wrote:
> > I just noticed that in the current nightly builds, games crash if the
> > plotslices array fills up and gets expanded.
> >
> > #0  0x0822ffa6 in fb_End ()
> > #1  0x08228ee9 in fb_ErrorThrowEx ()
> > #2  0x08117af0 in CREATE_PLOTSLICE_HANDLE (SL=<error reading variable>)
> > at yetmore.bas:3785
> > #3  0x08102366 in SCRIPTMISC (ID=<error reading variable>) at
> > yetmore.bas:1982
> > #4  0x08069d9f in SFUNCTIONS (CMDID=<error reading variable>) at
> > game.bas:2049
> > #5  0x081470ed in SCRIPTINTERPRETER () at hsinterpreter.bas:95
> > #6  0x08063b1b in INTERPRET () at game.bas:1474
> > #7  0x080783b5 in main (__FB_ARGC__=<error reading variable>,
> > __FB_ARGV__=<error reading variable>)
> >    at game.bas:581
> >
> > Here is where the crash happens:
> >
> >
> >  'If no room is available, make the array bigger.
> >  REDIM PRESERVE plotslices(LBOUND(plotslices) TO UBOUND(plotslices) +
> > 32) as Slice Ptr
> >  'Store the slice pointer in the handle slot
> >  plotslices(i) = sl
> >
> >
> > This bug started when I did the -lang fb cleanup on this file in
> > revision 4745, but I haven't yet figured out what I screwed up.
> >
> > ---
> > James
> 
> Fixed. Why are you making loop variables all over the place local
> anyway? This wasn't the first one I've seen where you ended up masking
> a variable in an outer scope (forgot to delete it)

I was doing a lot of text search and replace, for things like FOR i = 
replaced with FOR i as integer =

In most cases that was safe, because if "i" was used after the loop, it 
would throw an error the next time I compiled. However, I guess that 
could screw up places where there was a DIM i as integer preceding the 
loop. Most of those are left over from when I didn't know you could do 
FOR i as integer = but some of them were apparently that way for a 
reason.

---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to