Closed ApacheTech closed 2 years ago
Happens after:
24.2.2022 20:36:04 [Notification] Exiting current game to main menu, reason: leave world button pressed
I am already purging the PlayerPins
Dictionary when the class is disposed. This could be a race condition issue. As a safety measure, I've added a loop that explicitly disposes the texture, within each MapComponent, prior to purging the dictionary, and added a finaliser to the class, to hopefully degrade gracefully as the static class loses scope, without the Dispose method being called.
It's likely that within the degredation chain, my class was disposed before the vanilla classes, so as it went out of scope, the dispose method was never explicitly called. The finaliser should solve that issue... maybe.
One final measure has been to add an event handler to manually dispose the static resources as the player leaves the world.
I think, with these measures in place, I should have catered for each eventuality. However, it will be an on-going learning experience to find how, when, and where to dispose of static resources.