WilliamL wrote:
Hi Luis - thanks for the program. It was my understanding that when CreateImage was used the last image (of the same value) was automatically freed so no FreeImage was needed. I'm not sure where I read that but it appears to be wrong.
No you are right, and this code is wrong under this aspect.
According to the help:
help wrote:
CreateImage(2, 640, 480) ; Create an image, the n°2
ResizeImage(2, 320, 240) ; Resize the n°2 image
CreateImage(2, 800, 800) ; Create a new image in the n°2 index, the old one is automatically free'ed
and
help wrote:
The purpose of this section is to describe the behaviour, creation, and handling of objects in PureBasic. For the demonstration, we will use the Image object, but the same logic applies to all other PureBasic objects.
I never use static numbering in a real program, so I overlooked this (or better I forgot about it, not really relying on this behavior).
Indeed the include should be modified to accommodate that too, but I'm not 100% sure this automatic freeing always happen with any pb command involving pb objects.