prime31 / Nez

Nez is a free 2D focused framework that works with MonoGame and FNA
MIT License
1.76k stars 355 forks source link

Fix TooltipManager.HideAll modifying the _shownTooltips collection while iterating over it. #741

Closed oshelton closed 1 year ago

oshelton commented 1 year ago

The TooltipManager.HideAll method would result in tooltips being removed from _shownTooltips while it was being iterated over resulting in an exception being thrown if any tooltips were visible when it was called.

A simpler solution would have been to use the Linq ToArray operator, but that would have had the side effect of creating a shallow copy of the collection and that can be easily avoided in this case.