Libgdx - pixmap already disposed
<pre><code>04-16 12:17:58.353 12029-12056/com.nisvol.squaresmash E/AndroidRuntime: FATAL EXCEPTION: GLThread 664
                                                                Process: com.nisvol.squaresmash, PID: 12029
                                                                com.badlogic.gdx.utils.GdxRuntimeException: Pixmap already disposed!
                                                                    at com.badlogic.gdx.graphics.Pixmap.dispose(Pixmap.java:315)
                                                                    at com.badlogic.gdx.graphics.g2d.PixmapPacker$Page$1.dispose(PixmapPacker.java:379)
                                                                    at com.badlogic.gdx.graphics.g2d.BitmapFont.dispose(BitmapFont.java:315)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.dispose(GameScreen.java:306)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.changeScreen(GameScreen.java:209)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.update(GameScreen.java:168)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.render(GameScreen.java:261)
                                                                    at com.badlogic.gdx.Game.render(Game.java:46)
                                                                    at com.nisvol.squaresmash.SquareSmash.render(SquareSmash.java:44)
                                                                    at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:474)
                                                                    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
                                                                    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
04-16 12:18:02.533 12029-12029/com.nisvol.squaresmash E/AndroidGraphics: waiting for pause synchronization took too long; assuming deadlock and killing
</code></pre>

<p>I know this might not be enough, just the error I mean. But the thing is that my game runs fine on my phone, but then I tried it on an older phone, and the game kept crashing. But the weird thing is it crashed only when I got a score higher than about 50, and after it went to the game over screen.</p>

<p>So I start the Game Screen and play the game, get a higher score than 50 (objects fall from the sky, you have to collect them, and yes if the object is not on the screen it is removed) and when I come to the Game Over Screen it says: game stopped working... And as you can see it says the Pixmap has been disposed??? I have no idea what that means.</p>

<p>The only thing I dispose of in Game Screen is a FreeTypeFontGenerator that is in no way connected to Game Over screen, because I initialize it like this:</p>

<pre><code>FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 40;
parameter.color = Color.BLACK;
showScore = generator.generateFont(parameter);
generator.dispose();
</code></pre>

<p>And in Game Over Screen I do the same again. So what could be the cause?</p>