title: Box2D - Can't destroy multiple fixtures
body: <p>I'm using box2d along with libgdx on a project I'm working on. I'm having a slight problem destroying a body/the fixtures of a body. Essentially, I want to completely destroy the body, which I do by destroying the fixtures of said body. Everything works perfectly fine with a body with one fixture, but when I use two fixtures, only one fixture get's destroyed, leaving the body intact with the other fixture.</p>
  
  <p>Here's two pictures to demonstrate what I mean: </p>
  
  <p>With both fixtures:
  <img src="https://i.stack.imgur.com/fSE91.png" alt="With both fixtures"></p>
  
  <p>With only one fixture:
  <img src="https://i.stack.imgur.com/yCru4.png" alt="With only one fixture"></p>
  
  <p>Here is how I create the body:</p>
  
  <pre><code>BodyDef bodyDef = new BodyDef();
          bodyDef.type = BodyType.DynamicBody;
          bodyDef.position.set(level.character.position);
          Body body = b2world.createBody(bodyDef);
          body.setUserData(level.character);
          level.character.body = body;
  
          CircleShape polygonShapeHead = new CircleShape();
          origin.x = level.character.circleBoundOrigin.x * 2.0f;
          origin.y = level.character.circleBoundOrigin.y * 3.0f;
          //polygonShapeHead.setAsBox(level.character.circleBoundOrigin.x,
                  //level.character.circleBoundOrigin.y, origin, 0);
          polygonShapeHead.setPosition(origin);
          polygonShapeHead.setRadius(level.character.circleBoundOrigin.x);
          FixtureDef fixtureDefHead = new FixtureDef();
          fixtureDefHead.shape = polygonShapeHead;
          fixtureDefHead.friction = level.character.friction.x;
          body.createFixture(fixtureDefHead);
  
          polygonShapeHead.dispose();
  
          PolygonShape polygonShapeBod = new PolygonShape();
          origin = level.character.rectBoundOrigin;
          polygonShapeBod.setAsBox(level.character.rectBoundOrigin.x,
                  level.character.rectBoundOrigin.y, origin, 0);
          FixtureDef fixtureDefBod = new FixtureDef();
          fixtureDefBod.shape = polygonShapeBod;
          fixtureDefBod.friction = level.character.friction.x;
          body.createFixture(fixtureDefBod);
  
          polygonShapeBod.dispose();
  </code></pre>
  
  <p>Here is my code for destroying the bodies:</p>
  
  <pre><code>public static void removeSpecifiedBodies() {
          for (Body body : bodiesToRemoveList) {
              Array&lt;Fixture&gt; fixtures = body.getFixtureList();
              for (Fixture fixture : fixtures) {
                  body.destroyFixture(fixture);
              }
          }
          bodiesToRemoveList.clear();
      }
  </code></pre>
  
  <p>I call this static method after my b2world is stepped. I checked the logging, and the fixtures size is 2, and it is being run twice, but only one fixture is being destroyed. Why is this happening? And what is being destroyed? It runs twice, but I'm only seeing one of them getting destroyed.</p>
  
  <p>Edit: Instead of using that above remove, method, I added</p>
  
  <pre><code>for(Body body : CollisionHandler.bodiesToRemoveList)
              b2world.destroyBody(body);
  </code></pre>
  
  <p>after b2world.step, but it froze everything. :(</p>