From 08371bfb91a7d21485be2c3e89e260a5af2eacb8 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 30 Sep 2016 21:43:13 -0400 Subject: [PATCH] v0.4.3: fixed a memory leak involving toasts --- .../shatteredpixel/shatteredpixeldungeon/ui/Toast.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java index c8657ce31..af149ba49 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java @@ -76,7 +76,14 @@ public class Toast extends Component { text.setPos(close.left() - MARGIN_HOR - text.width(), y + (height - text.height()) / 2); PixelScene.align(text); } - + + @Override + public synchronized void kill() { + super.kill(); + //need to also destroy the text so that memory is freed + text.destroy(); + } + public void text( String txt ) { text.text( txt ); }