aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2021-02-27 18:02:59 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2021-02-27 18:02:59 +0200
commit9bd0e4829bd08a5ed0860aafc6288290ceac5eae (patch)
tree46850608d1377f07985664acc38abb612c8657e0 /src/main/java/io
parent591a5dec147c63da08adc1428cc3a66daf3cddd4 (diff)
downloadLibGui-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.java8
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);
}