[World Map Manager] Thread safety concerns in universal classes. #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Having both the server, and the client use the same method to hook as an event listener, means that any Harmony patches that are only supposed to be run on one side, will run on both sides, even though only one side patched the method. The fix for this is to separate the logic into separate paths between the client, and the server. This allows for more granular stack traces, more granular harmony patching, and more maintainable code.
I've also added thread safety into the generation, and iteration of map layers. Using a snapshot of the list protects the process against mutation of the lists while the operation is in progress. i.e. if someone adds in new map layers, while they are being iterated over.
Finally, just a general code clean as an iterative improvement towards best practice.
No functionality has been changed within this PR.
Fix Log: