From 5afde372a2944f058703cb2e39c66556eec480c0 Mon Sep 17 00:00:00 2001 From: chickeneer Date: Sun, 13 Nov 2022 18:14:52 -0600 Subject: [PATCH] leanup lastCommandOperationContext after command has executed #337 This is to deter acf from holding onto references of context objects which would otherwise be garbage collected post execution --- core/src/main/java/co/aikar/commands/BaseCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/co/aikar/commands/BaseCommand.java b/core/src/main/java/co/aikar/commands/BaseCommand.java index d502e48a..4f53fb7e 100644 --- a/core/src/main/java/co/aikar/commands/BaseCommand.java +++ b/core/src/main/java/co/aikar/commands/BaseCommand.java @@ -153,7 +153,7 @@ public abstract class BaseCommand { */ private ExceptionHandler exceptionHandler = null; /** - * The last operative context data of this command. This may be null if this command hasn't been run yet. + * The last operative context data of this command. This may be null if this command is not currently being executed. */ private final ThreadLocal lastCommandOperationContext = new ThreadLocal<>(); /** @@ -521,6 +521,7 @@ public abstract class BaseCommand { */ private void postCommandOperation() { CommandManager.commandOperationContext.get().pop(); + lastCommandOperationContext.set(null); execSubcommand = null; execLabel = null; origArgs = new String[]{};