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

#iterator() cannot be used nested. #209

Closed
fechy opened this issue Jan 16, 2016 · 5 comments
Closed

#iterator() cannot be used nested. #209

fechy opened this issue Jan 16, 2016 · 5 comments
Labels

Comments

@fechy
Copy link

fechy commented Jan 16, 2016

Unfortunately, since the last release (1.7.1) I'm having this issue:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: #iterator() cannot be used nested.
    at com.badlogic.gdx.utils.Array$ArrayIterator.hasNext(Array.java:541)
    at com.badlogic.ashley.core.Engine.update(Engine.java:175)
    at com.kingmonkey.arkanoid.internal.CustomEngine.update(CustomEngine.java:25)
    at com.kingmonkey.arkanoid.game.controllers.EngineController.update(EngineController.java:41)
    at com.kingmonkey.arkanoid.screens.GameScreen.render(GameScreen.java:187)
    at com.kingmonkey.arkanoid.MainGame.render(MainGame.java:97)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:218)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:123)

This is because this change introduced in 1.7.1 on Engine.java:

-       for(int i=0; i<systems.size; i++){
 -          EntitySystem system = systems.get(i);
 +      for (EntitySystem system : systemManager.getSystems()) {

I'm not entirely sure how this happens, although I know it has to do with postRunnables. This happens when I do a heavy removal of entities and box2d bodies which are done on a postRunnable otherwise Box2d will issue a sigfaul.

I'll try to came up with a better explanation and possible a test case. In the mean time, I'll like you to consider to go back to the previous code if this is not entirely necessary.

@dsaltares dsaltares added the bug label Jan 17, 2016
@dsaltares
Copy link
Member

This is because we re-use an internal iterator to avoid allocations. You can still instantiate a new iterator yourself. Will look into it anyway.

@manuelbua
Copy link

I'm also affected by this bug, but i'm currently using the Maven repo with gradle and i'm not sure the best way to update in this case? Is a new release expected to be out soon or should i consider switching to the git version?

@dsaltares
Copy link
Member

I can make a patch release later this evening.

@manuelbua
Copy link

Thank you much!

@dsaltares
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants