Skip to content

Commit

Permalink
Remove release on copy for CCL (with note)
Browse files Browse the repository at this point in the history
- Was causing crashes in some cases (e.g. DE's `TileDataManager#detectAndSendChangesToListeners`)
- Don't really know a way to fix this if it causes packet leaks now...
  • Loading branch information
jchung01 committed Jul 30, 2024
1 parent ebbb412 commit d1118c5
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,8 @@ private static void utRetainForOps(Packet<INetHandler> packet, CallbackInfo ci)
}
}

@Shadow
public abstract boolean release();

/**
* Release this buf after copying it, just to be safe.
*/
@Inject(method = "toPacket", at = @At(value = "RETURN"))
private void utReleaseOriginal(CallbackInfoReturnable<FMLProxyPacket> cir)
{
this.release();
}
// Releasing the PacketCustom on copy to packet would be ideal, but some mods still use the PacketCustom after calling this...
// But there isn't any other good way (AFAIK) to release without knowing a mod's specific usage.
// Excluding this prevents crashes from deallocating too early, but could there be leaks? If so, needs more investigation.
// @Inject(method = "toPacket", at = @At(value = "RETURN"))
}

0 comments on commit d1118c5

Please sign in to comment.