Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call entity:destroy() too many times and get an error #16

Closed
drhayes opened this issue Jul 24, 2018 · 1 comment
Closed

Call entity:destroy() too many times and get an error #16

drhayes opened this issue Jul 24, 2018 · 1 comment

Comments

@drhayes
Copy link

drhayes commented Jul 24, 2018

Here's the stacktrace from my game:

stack traceback:
	[string "boot.lua"]:637: in function '__newindex'
	lib/concord/list.lua:49: in function 'remove'
	lib/concord/instance.lua:76: in function 'flush'
	lib/concord/instance.lua:197: in function 'emit'
	game.lua:184: in function 'drawEntities'
	states/inWorld.lua:78: in function 'f'
	lib/gamera.lua:183: in function 'draw'
	core/camera.lua:65: in function 'draw'
	states/inWorld.lua:75: in function 'draw'
	main.lua:34: in function 'draw'
	[string "boot.lua"]:513: in function <[string "boot.lua"]:493>
	[C]: in function 'xpcall'```

I'm *pretty* sure what's happening is that one of my physics collision responders is removing something multiple times. If I add this line to `list.lua` inside `List:remove`:

```function List:remove(obj)
   local index = self.pointers[obj]
   if not index then return end -- this one's the new line!
   local size  = self.size

This error doesn't happen in my code anymore. Pretty sure that index comes back nil and makes things blow up.

Let me know if you need more info, can't repro, or it's totally something that's just my problem. I can also PR this up if you want.

@Keyslam
Copy link
Collaborator

Keyslam commented Jul 30, 2018

Added your suggested line in the latest commit, hopefully that'll prevent it from happening again.
Thanks!

@Keyslam Keyslam closed this as completed Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants