juancarloscp52 / BedrockIfy

A Minecraft mod that implements some Minecraft Bedrock features into Java edition.
GNU General Public License v3.0
178 stars 38 forks source link

BedrockIfy 1.6 crashes the game if the mixin `client.features.fishingBobber` is enabled and MemoryLeakFix is loaded #216

Closed Iristallite closed 1 year ago

Iristallite commented 1 year ago

I've noticed that, if BedrockIfy v1.6 and MemoryLeakFix are loaded together in 1.19.3 (Fabric), the game crashes.
Looking at the log, this seems to be a memory leak caused by the new 3D fishing hooks feature?
I've tested with and without most of my other installed mods, and the crash only happens if MemoryLeakFix and BedrockIfy are loaded together. Not sure if this is on MemoryLeakFix or BedrockIfy, but disabling the mixin client.features.fishingBobber does fix the crash, so...

Game log (client.features.fishingBobber enabled; game crashed)

lonefelidae16 commented 1 year ago

Can confirm, it seems to be caused by MemoryLeakFix.

I was going to add a static and final modifier for a member variable that are unique and use the model around in mixin class, but this mod initialize the all of mixin class ~before executing BedrockifyClient#onInitializeClient~. ~Of course before calling EntityModelLayerRegistry#registerModelLayer, and~ there is no model layer, thus causing that crash. edit: I noticed this is not the case when I looked at the log. Apparently my singleton design was considered a memory leak.

Now removed the static modifier from the model and my instance launched normally including both mods. I will create a new PR for this fix.

// Why does my feature always cause problems...? Sorry Juan Carlos :(

juancarloscp52 commented 1 year ago

// Why does my feature always cause problems...? Sorry Juan Carlos :( Haha Don't worry! Thank you for the quick fix :)