From cfe25db2731b9a8f605e8d09880fcd9bbb31acec Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Thu, 4 Jan 2024 17:59:33 -0500 Subject: [PATCH] Fix tooltip mem leak --- arc-core/src/arc/scene/ui/Tooltip.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/arc-core/src/arc/scene/ui/Tooltip.java b/arc-core/src/arc/scene/ui/Tooltip.java index 48a779223..83d5c344a 100644 --- a/arc-core/src/arc/scene/ui/Tooltip.java +++ b/arc-core/src/arc/scene/ui/Tooltip.java @@ -8,7 +8,6 @@ import arc.scene.*; import arc.scene.event.*; import arc.scene.ui.layout.*; -import arc.struct.*; import arc.util.*; import arc.util.Timer.*; @@ -154,7 +153,6 @@ public void hide(){ */ public static class Tooltips{ private static Tooltips instance; - final Seq shown = new Seq<>(); /** Default text tooltip provider. */ public Func textProvider = text -> new Tooltip(t -> t.add(text)); @@ -199,7 +197,6 @@ public void run(){ if(stage == null) return; stage.add(showTooltip.container); showTooltip.container.toFront(); - shown.add(showTooltip); showTooltip.container.clearActions(); showAction(showTooltip); @@ -247,7 +244,6 @@ public void hide(Tooltip tooltip){ showTooltip = null; showTask.cancel(); if(tooltip.container.hasParent()){ - shown.remove(tooltip, true); hideAction(tooltip); resetTask.cancel(); Timer.schedule(resetTask, resetTime); @@ -270,17 +266,6 @@ protected void hideAction(Tooltip tooltip){ .addAction(sequence(parallel(alpha(0.2f, 0.2f, fade), scaleTo(0.05f, 0.05f, 0.2f, Interp.fade)), remove())); } - public void hideAll(){ - resetTask.cancel(); - showTask.cancel(); - time = initialTime; - showTooltip = null; - - for(Tooltip tooltip : shown) - tooltip.hide(); - shown.clear(); - } - /** Shows all tooltips on hover without a delay for {@link #resetTime} seconds. */ public void instant(){ time = 0;