blish-hud / Blish-HUD

A Guild Wars 2 overlay with extreme extensibility through compiled modules.
https://blishhud.com
MIT License
320 stars 59 forks source link

thread safety changes for tweener class #885

Closed eksime closed 1 year ago

eksime commented 1 year ago

Discord Discussion

Breaking change: no

This is an attempt to fix #812 - mostly by converting the main Dictionary object used by the tweener class to a ConcurrentDictionary and adding locks to inner list access.

It also swaps out the implementations of toadd/toremove to ConcurrentQueue instead of list, as it's a more natural fit for the usecase.

There's also some minor cleanup of unused variables and formatting.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

eksime commented 1 year ago

To expand on this - the tweener code is quite messy, and relies on a lot of reflection and boxing operations. In the future, if it's something you would be open to, I'd quite like to tackle reimplementing the core of it to make better use of generics for non-boxing operations on tween values & attaching the tweens to their targets using ConditionalWeakTables so that they don't prevent objects getting collected.