diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2021-02-27 18:02:59 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2021-02-27 18:02:59 +0200 |
commit | 9bd0e4829bd08a5ed0860aafc6288290ceac5eae (patch) | |
tree | 46850608d1377f07985664acc38abb612c8657e0 /src/main/java/io | |
parent | 591a5dec147c63da08adc1428cc3a66daf3cddd4 (diff) | |
download | LibGui-9bd0e4829bd08a5ed0860aafc6288290ceac5eae.tar.gz LibGui-9bd0e4829bd08a5ed0860aafc6288290ceac5eae.tar.bz2 LibGui-9bd0e4829bd08a5ed0860aafc6288290ceac5eae.zip |
Fix memory leak in ScreenNetworking
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java index 0d9a74e..cd2651a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java @@ -92,7 +92,13 @@ public class ScreenNetworkingImpl implements ScreenNetworking { if (receiver != null) { buf.retain(); - executor.execute(() -> receiver.onMessage(buf)); + executor.execute(() -> { + try { + receiver.onMessage(buf); + } finally { + buf.release(); + } + }); } else { LOGGER.warn("Message {} not registered for {} on side {}", messageId, screenHandler, networking.side); } |