Crash when switching texture packs a lot

Mr_KrzYch00

Official Terrarian
Steam or GOG
Steam
Single Player/Multiplayer
Both
Operating System
Windows 7
Terraria Version
1.4.0.5
Controls Used
Keyboard/Mouse
I don't know if anyone already reported this problem but this happens when a person is changing Texture Packs over and over again while loading the world every time. After Nth world loading time this window will appear and the game will close:

Clipboard01.png


Seems like some object is incorrectly deleted from the memory when it's still used/accessed later in the code or some error occurs while loading texture packs which is silently ignored (or not correctly checked) resulting in a crash afterwards. Of course there can be numerous ways to trigger such error which basically means we want to access something that doesn't exist anymore (like free'd pointed in C, or an object in C# [mono] that was garbage collected/disposed of and it shouldn't have been yet or at all). It may be a trivial issue like a small racing condition to fix, change coding lines order or put an additional code to make sure we don't have objects in Disposed state, null'ed, or other state that will be later considered as an incorrect access. If we do, try to reload those objects, or if impossible, inform user about the need to reload the game OR, if it may occur during user's game play, try to work with game's stock data (load, fallback etc.). A default tile, even if it may completely not match the loaded Texture Pack, is still better than getting a crash.

Thanks.
 
Last edited:
Back
Top Bottom