mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
* Add unit test that demonstrates the loss of idle handlers added via Application.MainLoop.Invoke * Fixes #1994. Ensure that only a single idle handlers list exists at one time * Previous implementation locked on idleHandlers but this is dangerous because it is reallocated. It was therefore possible for two different threads to hold locks on two different instances of idleHandlers simultaneously. The idle handlers added to the older instance of idleHandlers would then be lost. This was particularity catastrophic when combined with async/await continuations being lost. * Add dedicated lock object idleHandlersLock and use when modifying idleHandlers * Fix additional bug in RemoveIdle that was locking the token instead of idleHandlers * Return a copy via the IdleHandlers property as it was directly returning idleHandlers. This cannot safely be done without first acquiring idleHandlersLock * Address code review feedback for #1994: Make IdleHandler immutable via ReadOnlyCollection * Address code review feedback for #1994: Avoid the possibility of IdleHandlers changing while being used Co-authored-by: Karl Janke <karl.janke@groundprobe.com> Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
Automated Unit Tests
Terminal.Gui uses xunit for automated unit tests run automatically with Github Actions.
See the Testing wiki for details on how to add more tests.