Computer Science Canada A bug in Turing |
Author: | Insectoid [ Sun May 21, 2017 8:54 pm ] | ||||||
Post subject: | A bug in Turing | ||||||
I've been using Turing for nine years now and today hunter2 and I found our first bug in the language itself! Neat stuff! Discussion can be found here: http://compsci.ca/v3/viewtopic.php?p=291034 The bug is with Sprites and View.Set. If you change the size of the run window after creating a sprite, that sprite will be automatically freed. Any attempt to use that sprite will crash the program. Here's a program that causes it:
The following also fails:
The following code executes with no errors:
I suspect that when a sprite is created, it is bound to the active window that created it. Resizing the window does not actually resize, but destroys the original and creates a new one with the new dimensions. The sprites can no longer draw to the original window, but only knows one error ('sprite was freed') and returns that. Or maybe destroying the window recursively destroys everything attached to it. We'll have to poke through the source code (well, somebody will, and it won't be me) to find out for sure what's going on. I can't find anything in the documentation for View.Set, Sprite, or Window that would explain this behavior. |