Looping through obounds, and deleting the items in it causes refcount errors.
I've tested this with obounds as well.
DarkCampainger says no errors occur if you use range, view, etc.
I don't really have much information about the bug, but Lummox JR told me to post a bug report.
Numbered Steps to Reproduce Problem:
1. Run project (linked in the next section)
2. Turn on Dream Seeker's debug mode. ".configure debug on" in the Command prompt. I don't think the errors display in Dream Seeker otherwise, not entirely sure.
3. Click somewhere to spawn a big blue ball,
4. Wait for a red ball to collide with a blue ball.
5. Wait for refcount errors to appear. They should appear when the collision happens, and when the blue ball "expires".
6. Ref count errors appear at line 68 and 86.
Code Snippet (if applicable) to Reproduce Problem:
I've uploaded a project where this happens here. This is an older version of the game currently found at SuperSaiyanx.Balls, it doesn't share much of the same code now.
Code surrounding line 85:
makeBig(Small/c)
var //I assign the values of the variables from c to new variables, as to not keep a reference to c in Big's New()
sx = c.step_x
sy = c.step_y
loc = c.loc
del c
new /Big (loc, sx, sy)
// makeBig is called by:
Small
Move(NewLoc)
spawn(2)
for(var/Big/c in obounds(src))
if(inCircle(c, src))
makeBig(src)
sleep(5)
Code surrounding line 68:
Big
New(loc, sx, sy)
step_x -= 0.5*(bound_width) - sx
step_y -= 0.5*(bound_height) - sy
for(var/Small/x in obounds(src))
makeBig(x)
sleep(5)
spawn(50)
del src
Expected Results:
No errors, deletes without any kind of output.
Actual Results:
Refcount errors, deletes fine aside from that.
The refcount=x fluctuates, for line 85.
BUG: Finished erasure with refcount=229 (ref=2:18) DM (Balls of Reaction.dm:85)
All errors on line 68 are refcount=1 (I'm assuming the reference is the paramater for obounds)
BUG: Finished erasure with refcount=1 (ref=2:6) DM (Balls of Reaction.dm:68)
Does the problem occur:
Every time? Or how often? Every time a red ball hits a blue ball.
In other games? No idea.
In other user accounts? Yes.
On other computers? Yes.
When does the problem NOT occur?
If you use view, oview, and so on it doesn't occur.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
It's happened for a long while, ever since obounds was introduced, I guess.
Workarounds:
set loc to null, rather than delete.