ImageFrame icon indicating copy to clipboard operation
ImageFrame copied to clipboard

Fix hash collisions producing thread checks on Folia

Open TechnicallyCoded opened this issue 1 year ago • 2 comments

There was an error where certain image frame IDs could cause ConcurrentHashMap bucket .equals() calls. This behavior under Folia tiggers checks for the thread that we should be on for this entity. This could obviously fail since it's async. This code should fix this, however, testing was not possible at the time of writing due to missing craftbukkit implementations.

TechnicallyCoded avatar May 12 '24 20:05 TechnicallyCoded

Currently, the class declares this map on the class level and looks like it is accessed off the entity thread. https://github.com/LOOHP/ImageFrame/blob/9b8efe229552763d9cde5b9bbbff5de49c2b9259/common/src/main/java/com/loohp/imageframe/objectholders/AnimatedFakeMapManager.java#L61 Wouldn't something need to also be done for this map if even equals check fails?

LOOHP avatar May 14 '24 19:05 LOOHP

Yes, sounds correct. Will need updating.

TechnicallyCoded avatar May 15 '24 00:05 TechnicallyCoded