A little while ago I added the following code to my program to preload colors for players to choose from.
create bitmap 4, 256, 256
for x = 1 to 27
cls Colors(x).color
Colors(x).img = FreeImg()
get image Colors(x).img, 0, 0, 256, 256
next x
delete bitmap 4
The FreeImg() function just returns the next available image number.
So this code runs fine and all, but after I added it, there's another section of code that creates a new bitmap 4, uses it, then deletes bitmap 4 again.
Through hours of debugging (in step through mode) I finally tracked the crash to the line "delete bitmap 4". This section of code worked perfectly before I inserted the above code, and if I remove the above code it still works perfect.
So, any ideas what would be causing this line to crash the program?
It crashes to the "Your program has caused an error and must be shutdown...blah, blah, blah.." error with the Send / Don't Send buttons. So there's no meaningful data to indicate what might be happening.
I thought it might be memory, as I was working with nearly 200 images in memory at once, and almost 250 objects right before the crash. So I reduced the size of all my textures by half, but that didn't stop this either.