tooltip overlay: move tooltip clearing to a finally block

Tooltips must always be cleared after each frame, and the overlay is
responsible for this. This fixes tooltips erroneously stacking up in the
event of an exception in the overlay
This commit is contained in:
Adam
2019-07-20 21:52:33 -04:00
parent 262fa3ba47
commit 34243f727c

View File

@@ -66,6 +66,19 @@ public class TooltipOverlay extends Overlay
return null;
}
try
{
return renderTooltips(graphics, tooltips);
}
finally
{
// Tooltips must always be cleared each frame
tooltipManager.clear();
}
}
private Dimension renderTooltips(Graphics2D graphics, List<Tooltip> tooltips)
{
final Rectangle clientCanvasBounds = new Rectangle(client.getRealDimensions());
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
final Point mousePosition = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + OFFSET);
@@ -113,7 +126,6 @@ public class TooltipOverlay extends Overlay
newBounds.width = Math.max(newBounds.width, dimension.width);
}
tooltipManager.clear();
return newBounds.getSize();
}
}