title: How to clear libgdx listeners
body: <p>So in menu i have 3 buttons and all are with the same code. For the topic only important thing is</p>
  
  <pre><code>button2.addListener(new InputListener() {
      @Override
      public boolean touchDown(InputEvent event, float x, float y,
      int pointer, int button) {
          game.setGame();
          dispose();
      return true;
      }
  });
  </code></pre>
  
  <p>Then everything is going fine until:</p>
  
  <pre><code>button3.clearListeners(); // MainMenu.java:174 line in exeption 
  </code></pre>
  
  <p>and then exeption pops out:</p>
  
  <pre><code>Exception in thread "LWJGL Application" java.lang.IllegalStateException: Invalid between begin/end.
  at com.badlogic.gdx.utils.DelayedRemovalArray.clear(DelayedRemovalArray.java:125)
  at com.badlogic.gdx.scenes.scene2d.Actor.clearListeners(Actor.java:261)
  at com.racostyle.avdelux.MainMenu.dispose(MainMenu.java:174)
  at com.racostyle.avdelux.MainMenu$3.touchDown(MainMenu.java:123)
  at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:55)
  at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:165)
  at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:136)
  at com.badlogic.gdx.scenes.scene2d.Stage.touchDown(Stage.java:277)
  at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:300)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:200)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
  </code></pre>
  
  <p>EDIT: if i don't remove listeners they are still active and can be clickable, afc with exeptions.</p>