From 8ab716a429440357e3b0fa7669d8d0f9bee089c2 Mon Sep 17 00:00:00 2001 From: nacro711072 Date: Fri, 28 Oct 2022 00:15:44 +0800 Subject: [PATCH] fix memory leak due to Pixmap don't be released. (#7964) * fix memory leak due to Pixmap don't be released. * dispose pixmap early. --- core/src/com/unciv/ui/LoadingScreen.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/LoadingScreen.kt b/core/src/com/unciv/ui/LoadingScreen.kt index 585c893a93..f9d13dc191 100644 --- a/core/src/com/unciv/ui/LoadingScreen.kt +++ b/core/src/com/unciv/ui/LoadingScreen.kt @@ -36,7 +36,10 @@ class LoadingScreen( for (popup in previousScreen.popups) popup.isVisible = false previousScreen.render(Gdx.graphics.getDeltaTime()) } - val screenshot = Texture(Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.backBufferWidth, Gdx.graphics.backBufferHeight)) + val pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.backBufferWidth, Gdx.graphics.backBufferHeight) + val screenshot = Texture(pixmap) + pixmap.dispose() + if (previousScreen != null) { for (popup in previousScreen.popups) popup.isVisible = true }